summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Dalessio <mike.dalessio@gmail.com>2023-08-19 14:03:35 -0400
committerJemma Issroff <jemmaissroff@gmail.com>2023-08-21 10:43:23 -0700
commit926857eb1e124c62ef9cee52bb6c23c83e268ac6 (patch)
treea5eb07f4df934a6df63404a8687e4de4e51b77d4 /test
parente63bac3128a5ce584c904ee247ce5cafc5d0c56a (diff)
[ruby/yarp] fix: support newline-terminated regular expressions
Previously, parsing a snippet like this: %r\nfoo\n would result in tracking the second newline twice, resulting in a failed runtime assertion. Fixing that issue reveals another bug, which is that the _first_ newline was not being tracked at all. So we introduce a call to yp_newline_list right when we construct the REGEXP_BEGIN token. https://github.com/ruby/yarp/commit/0d5d759091
Diffstat (limited to 'test')
-rw-r--r--test/yarp/fixtures/newline-terminated-things.txt3
-rw-r--r--test/yarp/snapshots/newline-terminated-things.txt7
2 files changed, 10 insertions, 0 deletions
diff --git a/test/yarp/fixtures/newline-terminated-things.txt b/test/yarp/fixtures/newline-terminated-things.txt
index 3faf45ab4a..ba07c085b0 100644
--- a/test/yarp/fixtures/newline-terminated-things.txt
+++ b/test/yarp/fixtures/newline-terminated-things.txt
@@ -1,3 +1,4 @@
+<<<<<<< HEAD:test/yarp/fixtures/newline-terminated-things.txt
# note that %i, %I, %w, and %W do not support newline termination in CRuby
%
@@ -9,5 +10,7 @@ foo
%Q
foo
+=======
+>>>>>>> 0d5d759091 (fix: support newline-terminated regular expressions):test/fixtures/newline-terminated-things.txt
%r
foo
diff --git a/test/yarp/snapshots/newline-terminated-things.txt b/test/yarp/snapshots/newline-terminated-things.txt
index 946eb44a36..d01bd6a65a 100644
--- a/test/yarp/snapshots/newline-terminated-things.txt
+++ b/test/yarp/snapshots/newline-terminated-things.txt
@@ -1,3 +1,4 @@
+<<<<<<< HEAD:test/yarp/snapshots/newline-terminated-things.txt
ProgramNode(76...106)(
[],
StatementsNode(76...106)(
@@ -11,5 +12,11 @@ ProgramNode(76...106)(
"foo",
0
)]
+=======
+ProgramNode(0...7)(
+ [],
+ StatementsNode(0...7)(
+ [RegularExpressionNode(0...7)((0...3), (3...6), (6...7), "foo", 0)]
+>>>>>>> 0d5d759091 (fix: support newline-terminated regular expressions):test/snapshots/newline-terminated-things.txt
)
)