diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-06-14 12:27:25 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-06-17 01:48:52 +0900 |
commit | cd5cafa4a380e2459862b6e99ff0c381362ef1be (patch) | |
tree | a61479213a257113355bab53f7b1b0674b4fb664 /test/ruby/test_syntax.rb | |
parent | 278fefb96294adf9d27a78f919c714a31b65ef58 (diff) |
Respect the encoding of the source [Bug #18827]
Do not override the input string encoding at the time of preparation,
the source encoding is not determined from the input yet.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6015
Diffstat (limited to 'test/ruby/test_syntax.rb')
-rw-r--r-- | test/ruby/test_syntax.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_syntax.rb b/test/ruby/test_syntax.rb index b1fa3e5227..1d7b89de57 100644 --- a/test/ruby/test_syntax.rb +++ b/test/ruby/test_syntax.rb @@ -66,6 +66,15 @@ class TestSyntax < Test::Unit::TestCase f&.close! end + def test_script_lines_encoding + require 'tmpdir' + Dir.mktmpdir do |dir| + File.write(File.join(dir, "script_lines.rb"), "SCRIPT_LINES__ = {}\n") + assert_in_out_err(%w"-r./script_lines -w -Ke", "puts __ENCODING__.name", + %w"EUC-JP", /-K is specified/, chdir: dir) + end + end + def test_anonymous_block_forwarding assert_syntax_error("def b; c(&); end", /no anonymous block parameter/) assert_separately([], "#{<<-"begin;"}\n#{<<-'end;'}") |