From 3041f2156eae5dbcbe14562b6eef9389c9c50bdd Mon Sep 17 00:00:00 2001 From: nagachika Date: Sun, 30 Mar 2014 15:06:25 +0000 Subject: merge revision(s) r42230,r42231: [Backport #9651] parse.y, vm_eval.c: file encoding in eval * parse.y (yycompile): store file name as String to keep the encoding. * parse.y (rb_parser_compile_string_path, rb_parser_compile_file_path): new functions to pass file name as a String. * parse.y (gettable_gen): return a copy of the original file name, not a copy in filesystem encoding. * vm_eval.c (eval_string_with_cref): use Qundef instead of "(eval)". * parse.y (yycompile): store file name as String to keep the encoding. * parse.y (rb_parser_compile_string_path, rb_parser_compile_file_path): new functions to pass file name as a String. * parse.y (gettable_gen): return a copy of the original file name, not a copy in filesystem encoding. * vm_eval.c (eval_string_with_cref): use Qundef instead of "(eval)". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@45473 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_eval.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_eval.rb b/test/ruby/test_eval.rb index a97b982246..8e7416b333 100644 --- a/test/ruby/test_eval.rb +++ b/test/ruby/test_eval.rb @@ -478,4 +478,9 @@ class TestEval < Test::Unit::TestCase result = foo.instance_eval(&foo_pr) assert_equal(1, result, 'Bug #3786, Bug #3860, [ruby-core:32501]') end + + def test_file_encoding + fname = "\u{3042}".encode("euc-jp") + assert_equal(fname, eval("__FILE__", nil, fname, 1)) + end end -- cgit v1.2.3