diff options
| author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2026-01-20 19:10:16 +0900 |
|---|---|---|
| committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2026-01-20 19:10:16 +0900 |
| commit | 58f1127b51cf4fbb1f334f8701a041f40701dca2 (patch) | |
| tree | c30ea24a0651f6e63fdaeea27e57621ca3c19e6c /test/prism/ruby | |
| parent | 35a7b5159f39de2cac848c072674e5350cc41aa4 (diff) | |
Revert "[ruby/prism] Add Ripper :on_sp events for Prism.lex_compat and Prism::Translation::Ripper"
This reverts commit 35a7b5159f39de2cac848c072674e5350cc41aa4.
This broke syntax_suggest.
https://github.com/ruby/ruby/actions/runs/21167011751/job/60874111912
Diffstat (limited to 'test/prism/ruby')
| -rw-r--r-- | test/prism/ruby/ripper_test.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/test/prism/ruby/ripper_test.rb b/test/prism/ruby/ripper_test.rb index 280abd94ea..2a0504c19f 100644 --- a/test/prism/ruby/ripper_test.rb +++ b/test/prism/ruby/ripper_test.rb @@ -39,8 +39,6 @@ module Prism # Skip these tests that we haven't implemented yet. omitted_sexp_raw = [ - "bom_leading_space.txt", - "bom_spaces.txt", "dos_endings.txt", "heredocs_with_fake_newlines.txt", "heredocs_with_ignored_newlines.txt", @@ -94,7 +92,7 @@ module Prism assert_equal(expected, lexer.parse[0].to_a) assert_equal(lexer.parse[0].to_a, lexer.scan[0].to_a) - assert_equal(%i[on_int on_sp on_op], Translation::Ripper::Lexer.new("1 +").lex.map(&:event)) + assert_equal(%i[on_int on_op], Translation::Ripper::Lexer.new("1 +").lex.map(&:event)) assert_raise(SyntaxError) { Translation::Ripper::Lexer.new("1 +").lex(raise_errors: true) } end @@ -123,17 +121,15 @@ module Prism def assert_ripper_lex(source) prism = Translation::Ripper.lex(source) ripper = Ripper.lex(source) - - # Prism emits tokens by their order in the code, not in parse order - ripper.sort_by! { |elem| elem[0] } + ripper.reject! { |elem| elem[1] == :on_sp } # Prism doesn't emit on_sp + ripper.sort_by! { |elem| elem[0] } # Prism emits tokens by their order in the code, not in parse order [prism.size, ripper.size].max.times do |i| expected = ripper[i] actual = prism[i] - # Since tokens related to heredocs are not emitted in the same order, # the state also doesn't line up. - if expected && actual && expected[1] == :on_heredoc_end && actual[1] == :on_heredoc_end + if expected[1] == :on_heredoc_end && actual[1] == :on_heredoc_end expected[3] = actual[3] = nil end |
