Skip to content

Commit e86a282

Browse files
committed
Remove duplicate lex tests
`RipperTest` already does this (added in #3849) Since it doesn't use the token classes, it also lists out all the excludes instead of just claiming some are passing.
1 parent d1abb25 commit e86a282

File tree

1 file changed

+5
-47
lines changed

1 file changed

+5
-47
lines changed

test/prism/lex_test.rb

Lines changed: 5 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,6 @@
66

77
module Prism
88
class LexTest < TestCase
9-
except = [
10-
# https://bugs.ruby-lang.org/issues/21756
11-
"spanning_heredoc.txt",
12-
# Prism emits a single string in some cases when ripper splits them up
13-
"whitequark/dedenting_heredoc.txt",
14-
"heredocs_with_fake_newlines.txt",
15-
# Prism emits BEG for `on_regexp_end`
16-
"spanning_heredoc_newlines.txt",
17-
]
18-
19-
if RUBY_VERSION < "3.3.0"
20-
# This file has changed behavior in Ripper in Ruby 3.3, so we skip it if
21-
# we're on an earlier version.
22-
except << "seattlerb/pct_w_heredoc_interp_nested.txt"
23-
24-
# Ruby < 3.3.0 cannot parse heredocs where there are leading whitespace
25-
# characters in the heredoc start.
26-
# Example: <<~' EOF' or <<-' EOF'
27-
# https://bugs.ruby-lang.org/issues/19539
28-
except << "heredocs_leading_whitespace.txt"
29-
except << "whitequark/ruby_bug_19539.txt"
30-
31-
# https://bugs.ruby-lang.org/issues/19025
32-
except << "whitequark/numparam_ruby_bug_19025.txt"
33-
# https://bugs.ruby-lang.org/issues/18878
34-
except << "whitequark/ruby_bug_18878.txt"
35-
# https://bugs.ruby-lang.org/issues/19281
36-
except << "whitequark/ruby_bug_19281.txt"
37-
end
38-
39-
# https://bugs.ruby-lang.org/issues/21168#note-5
40-
except << "command_method_call_2.txt"
41-
42-
Fixture.each_for_current_ruby(except: except) do |fixture|
43-
define_method(fixture.test_name) { assert_lex(fixture) }
44-
end
45-
469
def test_lex_file
4710
assert_nothing_raised do
4811
Prism.lex_file(__FILE__)
@@ -83,16 +46,11 @@ def test_parse_lex_file
8346
end
8447
end
8548

86-
private
87-
88-
def assert_lex(fixture)
89-
source = fixture.read
90-
91-
result = Prism.lex_compat(source, version: "current")
92-
assert_equal [], result.errors
93-
94-
Prism.lex_ripper(source).zip(result.value).each do |(ripper, prism)|
95-
assert_equal ripper, prism
49+
if RUBY_VERSION >= "3.3"
50+
def test_lex_compare
51+
prism = Prism.lex_compat(File.read(__FILE__), version: "current").value
52+
ripper = Prism.lex_ripper(File.read(__FILE__))
53+
assert_equal(ripper, prism)
9654
end
9755
end
9856
end

0 commit comments

Comments
 (0)