diff options
author | Mike Dalessio <mike.dalessio@gmail.com> | 2023-08-27 16:43:27 -0400 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-08-28 12:37:31 +0000 |
commit | 9b87518ea0eff0c30c22db9c2394bb61db913646 (patch) | |
tree | 6d74a96a3ac02c21e0825d4eb68bfd7c9bdf32ca /test/yarp | |
parent | 29c5b851281da753ea0ae204afbd3f9010b466bc (diff) | |
download | ruby-9b87518ea0eff0c30c22db9c2394bb61db913646.tar.gz |
[ruby/yarp] fix: %I list spanning a heredoc
Similar to the previous %W fix, we accept a symbol node and
concatenate it onto an interpolated symbol.
https://github.com/ruby/yarp/commit/6b5911b95e
Diffstat (limited to 'test/yarp')
-rw-r--r-- | test/yarp/fixtures/spanning_heredoc.txt | 7 | ||||
-rw-r--r-- | test/yarp/snapshots/spanning_heredoc.txt | 31 |
2 files changed, 36 insertions, 2 deletions
diff --git a/test/yarp/fixtures/spanning_heredoc.txt b/test/yarp/fixtures/spanning_heredoc.txt index c1852e377a..a52a4c3c27 100644 --- a/test/yarp/fixtures/spanning_heredoc.txt +++ b/test/yarp/fixtures/spanning_heredoc.txt @@ -42,3 +42,10 @@ pp <<-A, %i[n\ m A n] + +# ripper gets this one wrong in the same way that YARP does ... +# TODO: yarp does not include the "\n" in "p\np" in the AST like ruby does +pp <<-A, %I[p\ +o +A +p] diff --git a/test/yarp/snapshots/spanning_heredoc.txt b/test/yarp/snapshots/spanning_heredoc.txt index 3d223e5e4d..301c70adf2 100644 --- a/test/yarp/snapshots/spanning_heredoc.txt +++ b/test/yarp/snapshots/spanning_heredoc.txt @@ -1,6 +1,6 @@ -ProgramNode(164...802)( +ProgramNode(164...964)( [], - StatementsNode(164...802)( + StatementsNode(164...964)( [CallNode(164...192)( nil, nil, @@ -183,6 +183,33 @@ ProgramNode(164...802)( nil, 0, "pp" + ), + CallNode(943...964)( + nil, + nil, + (943...945), + nil, + ArgumentsNode(946...964)( + [InterpolatedStringNode(946...950)( + (946...950), + [StringNode(958...960)(nil, (958...960), nil, "o\n")], + (960...962) + ), + ArrayNode(952...964)( + [InterpolatedSymbolNode(955...963)( + nil, + [SymbolNode(955...958)(nil, (955...958), nil, "p"), + StringNode(962...963)(nil, (962...963), nil, "p")], + nil + )], + (952...955), + (963...964) + )] + ), + nil, + nil, + 0, + "pp" )] ) ) |