diff options
| author | Kevin Newton <kddnewton@gmail.com> | 2024-05-16 13:28:27 -0400 |
|---|---|---|
| committer | Kevin Newton <kddnewton@gmail.com> | 2024-05-16 14:21:47 -0400 |
| commit | 012a80d768affcfb4e747a358f4941647381776b (patch) | |
| tree | 4021a1a8b4c78255b79149cad7fe47a7cfc89c8c /test | |
| parent | 0b4cf461e02b84c5ede91ff46b88d844353e1c3d (diff) | |
[PRISM] Enable TestISeq#test_syntax_error_message
Diffstat (limited to 'test')
| -rw-r--r-- | test/.excludes-prism/TestISeq.rb | 2 | ||||
| -rw-r--r-- | test/ruby/test_iseq.rb | 16 |
2 files changed, 11 insertions, 7 deletions
diff --git a/test/.excludes-prism/TestISeq.rb b/test/.excludes-prism/TestISeq.rb index ee3d92494e..499ae2e53d 100644 --- a/test/.excludes-prism/TestISeq.rb +++ b/test/.excludes-prism/TestISeq.rb @@ -1,4 +1,2 @@ -exclude(:test_syntax_error_message, "error message format") - exclude(:test_each_child, "https://bugs.ruby-lang.org/issues/20479") exclude(:test_trace_points, "https://bugs.ruby-lang.org/issues/20479") diff --git a/test/ruby/test_iseq.rb b/test/ruby/test_iseq.rb index d2a39e673f..df4b6651b0 100644 --- a/test/ruby/test_iseq.rb +++ b/test/ruby/test_iseq.rb @@ -347,11 +347,17 @@ class TestISeq < Test::Unit::TestCase end end assert_equal([m1, e1.message], [m2, e2.message], feature11951) - message = e1.message.each_line - message.with_index(1) do |line, i| - next if /^ / =~ line - assert_send([line, :start_with?, __FILE__], - proc {message.map {|l, j| (i == j ? ">" : " ") + l}.join("")}) + + if e1.message.lines[0] == "#{__FILE__}:#{line}: syntax errors found\n" + # Prism lays out the error messages in line with the source, so the + # following assertions do not make sense in that context. + else + message = e1.message.each_line + message.with_index(1) do |line, i| + next if /^ / =~ line + assert_send([line, :start_with?, __FILE__], + proc {message.map {|l, j| (i == j ? ">" : " ") + l}.join("")}) + end end end |
