From c5bcf769d1cb45da4d27e2776527887dac5059e1 Mon Sep 17 00:00:00 2001 From: Magnus Holm Date: Sat, 10 Feb 2024 09:17:33 +0100 Subject: [PATCH 1/3] Add test for line number in HEREDOC with method call This is currently failing in JRuby (see jruby/jruby#7272). --- language/heredoc_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/language/heredoc_spec.rb b/language/heredoc_spec.rb index b3b160fd11..a9d651a3e6 100644 --- a/language/heredoc_spec.rb +++ b/language/heredoc_spec.rb @@ -106,4 +106,10 @@ SquigglyHeredocSpecs.least_indented_on_the_first_line_single.should == "a\n b\n c\n" SquigglyHeredocSpecs.least_indented_on_the_last_line_single.should == " a\n b\nc\n" end + + it "reports line numbers inside HEREDOC with method call" do + -> { + eval %{< Date: Sat, 10 Feb 2024 09:34:26 +0100 Subject: [PATCH 2/3] Fix test of line number in HEREDOC in Ruby 3.3 --- language/heredoc_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/language/heredoc_spec.rb b/language/heredoc_spec.rb index a9d651a3e6..62d0e368ed 100644 --- a/language/heredoc_spec.rb +++ b/language/heredoc_spec.rb @@ -109,7 +109,7 @@ it "reports line numbers inside HEREDOC with method call" do -> { - eval %{< Date: Wed, 26 Jun 2024 13:27:02 +0300 Subject: [PATCH 3/3] Use __LINE__ math instead of executing heredoc with eval --- language/heredoc_spec.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/language/heredoc_spec.rb b/language/heredoc_spec.rb index 62d0e368ed..47ee9c2c51 100644 --- a/language/heredoc_spec.rb +++ b/language/heredoc_spec.rb @@ -109,7 +109,11 @@ it "reports line numbers inside HEREDOC with method call" do -> { - eval %{<