diff options
| author | tomoya ishida <tomoyapenguin@gmail.com> | 2023-06-27 19:18:58 +0900 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2023-06-27 10:19:03 +0000 |
| commit | eaad44adb2043f0b597196fd44cfaae8db3a3b18 (patch) | |
| tree | 41aa33f531a82222f45c5889ff43028c7b8fdaaf /test | |
| parent | 9dd869859760600df2d12c39ebaea0a306272256 (diff) | |
[ruby/irb] Always add \n at the end of the test input in RubyLex
test
(https://github.com/ruby/irb/pull/614)
https://github.com/ruby/irb/commit/e68c6128aa
Diffstat (limited to 'test')
| -rw-r--r-- | test/irb/test_ruby_lex.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/irb/test_ruby_lex.rb b/test/irb/test_ruby_lex.rb index 6bab52f3de..c90abdd5e6 100644 --- a/test/irb/test_ruby_lex.rb +++ b/test/irb/test_ruby_lex.rb @@ -101,7 +101,7 @@ module TestIRB def check_state(lines, local_variables: []) context = build_context(local_variables) - code = lines.join("\n") + code = lines.map { |l| "#{l}\n" }.join # code should end with "\n" tokens = RubyLex.ripper_lex_without_warning(code, context: context) opens = IRB::NestingParser.open_tokens(tokens) ruby_lex = RubyLex.new(context) @@ -791,7 +791,7 @@ module TestIRB assert_should_continue(['a;'], false) assert_should_continue(['<<A', 'A'], false) assert_should_continue(['a...'], false) - assert_should_continue(['a\\', ''], true) + assert_should_continue(['a\\'], true) assert_should_continue(['a.'], true) assert_should_continue(['a+'], true) assert_should_continue(['a; #comment', '', '=begin', 'embdoc', '=end', ''], false) @@ -801,13 +801,13 @@ module TestIRB def test_code_block_open_with_should_continue # syntax ok assert_code_block_open(['a'], false) # continue: false - assert_code_block_open(['a\\', ''], true) # continue: true + assert_code_block_open(['a\\'], true) # continue: true # recoverable syntax error code is not terminated - assert_code_block_open(['a+', ''], true) + assert_code_block_open(['a+'], true) # unrecoverable syntax error code is terminated - assert_code_block_open(['.; a+', ''], false) + assert_code_block_open(['.; a+'], false) # other syntax error that failed to determine if it is recoverable or not assert_code_block_open(['@; a'], false) |
