aboutsummaryrefslogtreecommitdiffstats
path: root/test/prism
diff options
context:
space:
mode:
authorMartin Emde <martin.emde@gmail.com>2023-11-29 20:02:43 -0800
committergit <svn-admin@ruby-lang.org>2023-11-30 14:10:04 +0000
commitaac8be803409a18f6c32b438d154432eeb6f49e8 (patch)
tree9543753bc0eaf5edd85bae3f004c484f33e73f98 /test/prism
parent1802d14ca8924bd67e0915c5ad9f1fad5dba0602 (diff)
downloadruby-aac8be803409a18f6c32b438d154432eeb6f49e8.tar.gz
[ruby/prism] Fix lex_compat for `<<HEREDOC # comment` at EOF
Fixes https://github.com/ruby/prism/pull/1874 https://github.com/ruby/prism/commit/304dd78dd2
Diffstat (limited to 'test/prism')
-rw-r--r--test/prism/fixtures/heredoc_with_comment.txt2
-rw-r--r--test/prism/snapshots/heredoc_with_comment_at_start.txt11
2 files changed, 13 insertions, 0 deletions
diff --git a/test/prism/fixtures/heredoc_with_comment.txt b/test/prism/fixtures/heredoc_with_comment.txt
new file mode 100644
index 0000000000..cf48c12051
--- /dev/null
+++ b/test/prism/fixtures/heredoc_with_comment.txt
@@ -0,0 +1,2 @@
+<<-TARGET # comment
+TARGET \ No newline at end of file
diff --git a/test/prism/snapshots/heredoc_with_comment_at_start.txt b/test/prism/snapshots/heredoc_with_comment_at_start.txt
new file mode 100644
index 0000000000..d9dfa8541e
--- /dev/null
+++ b/test/prism/snapshots/heredoc_with_comment_at_start.txt
@@ -0,0 +1,11 @@
+@ ProgramNode (location: (1,0)-(1,9))
+├── locals: []
+└── statements:
+ @ StatementsNode (location: (1,0)-(1,9))
+ └── body: (length: 1)
+ └── @ StringNode (location: (1,0)-(1,9))
+ ├── flags: ∅
+ ├── opening_loc: (1,0)-(1,9) = "<<-TARGET"
+ ├── content_loc: (2,0)-(3,0) = " data\r\n"
+ ├── closing_loc: (3,0)-(4,0) = "TARGET\r\n"
+ └── unescaped: " data\r\n"