ruby-changes:30123
From: nobu <ko1@a...>
Date: Fri, 26 Jul 2013 05:56:27 +0900 (JST)
Subject: [ruby-changes:30123] nobu:r42175 (trunk): envutil.rb: encoding
nobu 2013-07-26 05:54:54 +0900 (Fri, 26 Jul 2013) New Revision: 42175 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42175 Log: envutil.rb: encoding * test/ruby/envutil.rb (Test::Unit::Assertions#assert_separately): specify the encoding of source. Modified files: trunk/test/ruby/envutil.rb trunk/test/ruby/test_require.rb Index: test/ruby/test_require.rb =================================================================== --- test/ruby/test_require.rb (revision 42174) +++ test/ruby/test_require.rb (revision 42175) @@ -71,13 +71,16 @@ class TestRequire < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_require.rb#L71 end Dir.mkdir(File.dirname(require_path)) open(require_path, "wb") {} - assert_in_out_err([], <<-INPUT, %w(:ok), [], bug8165) - # coding: #{encoding} + assert_separately(%w[--disable=gems], <<-INPUT) # leave paths for require encoding objects + bug = "#{bug8165} require #{encoding} path" + path = "#{require_path}" enc_path = Regexp.new(Regexp.escape(RUBY_PLATFORM)) $:.replace([IO::NULL] + $:.reject {|path| enc_path !~ path}) - p :ok if require '#{require_path}' - p :ng if require '#{require_path}' + assert_nothing_raised(LoadError, bug) { + assert(require(path), bug) + assert(!require(path), bug) + } INPUT } end Index: test/ruby/envutil.rb =================================================================== --- test/ruby/envutil.rb (revision 42174) +++ test/ruby/envutil.rb (revision 42175) @@ -285,8 +285,11 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/ruby/envutil.rb#L285 file ||= loc.path line ||= loc.lineno end + line -= 2 src = <<eom - require #{__dir__.dump}'/envutil';include Test::Unit::Assertions;begin;#{src} +# -*- coding: #{src.encoding}; -*- + require #{__dir__.dump}'/envutil';include Test::Unit::Assertions;begin +#{src} ensure puts [Marshal.dump($!)].pack('m'), "assertions=\#{self._assertions}" end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/