From 012a80d768affcfb4e747a358f4941647381776b Mon Sep 17 00:00:00 2001 From: Kevin Newton Date: Thu, 16 May 2024 13:28:27 -0400 Subject: [PRISM] Enable TestISeq#test_syntax_error_message --- test/.excludes-prism/TestISeq.rb | 2 -- 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 -- cgit v1.2.3