Skip to content

Commit 48f575b

Browse files
committed
[GR-19220] Add missing spec for squiggly heredoc with backslash (#2237)
PullRequest: truffleruby/2374
2 parents e0ef0b2 + 9e088b2 commit 48f575b

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

spec/ruby/language/fixtures/squiggly_heredoc.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ def self.singlequoted
2929
HERE
3030
end
3131

32+
def self.backslash
33+
<<~HERE
34+
a
35+
b\
36+
c
37+
HERE
38+
end
39+
3240
def self.least_indented_on_the_first_line
3341
<<~HERE
3442
a

spec/ruby/language/heredoc_spec.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,11 @@
100100
SquigglyHeredocSpecs.singlequoted.should == "singlequoted \#{\"interpolated\"}\n"
101101
end
102102

103+
it "allows HEREDOC with <<~'identifier', no interpolation, with backslash" do
104+
require_relative 'fixtures/squiggly_heredoc'
105+
SquigglyHeredocSpecs.backslash.should == "a\nbc\n"
106+
end
107+
103108
it "selects the least-indented line and removes its indentation from all the lines" do
104109
require_relative 'fixtures/squiggly_heredoc'
105110
SquigglyHeredocSpecs.least_indented_on_the_first_line.should == "a\n b\n c\n"

spec/tags/language/heredoc_tags.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
fails:Heredoc string prints a warning if quoted HEREDOC identifier is ending not on same line
2+
fails:Heredoc string allows HEREDOC with <<~'identifier', no interpolation, with backslash

0 commit comments

Comments
 (0)