summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Dalessio <mike.dalessio@gmail.com>2023-08-17 03:33:13 -0400
committergit <svn-admin@ruby-lang.org>2023-08-18 18:30:49 +0000
commite1505aebf2dd5876db227f3e0c70e9ad1c4302fd (patch)
tree6bdbddc8ee3af1c1a818dc41bfc91e9ccacd5e48 /test
parentdb076d8e84d6b2d03fb280aee3835e1f88150c00 (diff)
[ruby/yarp] fix: multiple heredocs with embedded expressions with newlines
Set heredoc_end to NULL at the start of lexing a heredoc, to avoid having state from the previous heredoc confuse the parser's current location. https://github.com/ruby/yarp/commit/21ee304f0e
Diffstat (limited to 'test')
-rw-r--r--test/yarp/fixtures/dash_heredocs.txt16
-rw-r--r--test/yarp/snapshots/dash_heredocs.txt58
2 files changed, 72 insertions, 2 deletions
diff --git a/test/yarp/fixtures/dash_heredocs.txt b/test/yarp/fixtures/dash_heredocs.txt
index aba782c99a..3e663fae63 100644
--- a/test/yarp/fixtures/dash_heredocs.txt
+++ b/test/yarp/fixtures/dash_heredocs.txt
@@ -45,3 +45,19 @@ EOF
<<-'EOF'
a #{1}
EOF
+
+<<-A + <<-B
+ a
+A
+ b
+ #{2
+ }
+B
+
+<<-A + <<-B
+ a
+A
+ b
+ #{
+ 2}
+B
diff --git a/test/yarp/snapshots/dash_heredocs.txt b/test/yarp/snapshots/dash_heredocs.txt
index 24871b2735..e2eea3c2a5 100644
--- a/test/yarp/snapshots/dash_heredocs.txt
+++ b/test/yarp/snapshots/dash_heredocs.txt
@@ -1,6 +1,6 @@
-ProgramNode(0...217)(
+ProgramNode(0...278)(
[],
- StatementsNode(0...217)(
+ StatementsNode(0...278)(
[InterpolatedStringNode(0...6)(
(0...6),
[StringNode(7...11)(nil, (7...11), nil, " a\n")],
@@ -117,6 +117,60 @@ ProgramNode(0...217)(
(209...217),
[StringNode(218...227)(nil, (218...227), nil, " a \#{1}\n")],
(227...231)
+ ),
+ CallNode(232...243)(
+ InterpolatedStringNode(232...236)(
+ (232...236),
+ [StringNode(244...248)(nil, (244...248), nil, " a\n")],
+ (248...250)
+ ),
+ nil,
+ (237...238),
+ nil,
+ ArgumentsNode(239...243)(
+ [InterpolatedStringNode(239...243)(
+ (239...243),
+ [StringNode(250...256)(nil, (250...256), nil, " b\n" + " "),
+ EmbeddedStatementsNode(256...263)(
+ (256...258),
+ StatementsNode(258...259)([IntegerNode(258...259)()]),
+ (262...263)
+ ),
+ StringNode(263...264)(nil, (263...264), nil, "\n")],
+ (264...266)
+ )]
+ ),
+ nil,
+ nil,
+ 0,
+ "+"
+ ),
+ CallNode(267...278)(
+ InterpolatedStringNode(267...271)(
+ (267...271),
+ [StringNode(279...283)(nil, (279...283), nil, " a\n")],
+ (283...285)
+ ),
+ nil,
+ (272...273),
+ nil,
+ ArgumentsNode(274...278)(
+ [InterpolatedStringNode(274...278)(
+ (274...278),
+ [StringNode(285...291)(nil, (285...291), nil, " b\n" + " "),
+ EmbeddedStatementsNode(291...298)(
+ (291...293),
+ StatementsNode(296...297)([IntegerNode(296...297)()]),
+ (297...298)
+ ),
+ StringNode(298...299)(nil, (298...299), nil, "\n")],
+ (299...301)
+ )]
+ ),
+ nil,
+ nil,
+ 0,
+ "+"
)]
)
)