diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-16 13:25:11 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-16 13:25:11 +0000 |
commit | b7d6b2299bc2a2b8f205818396cd555b0e9e967a (patch) | |
tree | b050ebf2a681ea0ece1b5313517bb817b8d9ed15 /test/ruby | |
parent | 316f58076d29dcff053256992d9ec19fed7e698f (diff) | |
download | ruby-b7d6b2299bc2a2b8f205818396cd555b0e9e967a.tar.gz |
ruby.c: script __dir__ encoding
* ruby.c (process_options): fallback to the encoding of the script
name since rb_realpath_internal() cannot convert the encoding
when it is ASCII-8BIT.
* test/ruby/test_rubyoptions.rb (test___dir__encoding): explicitly
pass environment variables for locale as they are overriden by
invoke_ruby.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index c3ec35d345..083dcec027 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -952,16 +952,21 @@ class TestRubyOptions < Test::Unit::TestCase end def test___dir__encoding + lang = {"LC_ALL"=>ENV["LC_ALL"]||ENV["LANG"]} with_tmpchdir do testdir = "\u30c6\u30b9\u30c8" Dir.mkdir(testdir) Dir.chdir(testdir) do open("test.rb", "w") do |f| f.puts <<-END - p __FILE__.encoding == __dir__.encoding + if __FILE__.encoding == __dir__.encoding + p true + else + puts "__FILE__: \#{__FILE__.encoding}, __dir__: \#{__dir__.encoding}" + end END end - r, = EnvUtil.invoke_ruby("test.rb", "", true) + r, = EnvUtil.invoke_ruby([lang, "test.rb"], "", true) assert_equal "true", r.chomp, "the encoding of __FILE__ and __dir__ should be same" end end |