summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJemma Issroff <jemmaissroff@gmail.com>2023-09-08 12:09:30 -0400
committerGitHub <noreply@github.com>2023-09-08 12:09:30 -0400
commitaf5df9ee5ea6ad6270be020f74f9fb208e2bfb57 (patch)
tree8bb4e3fd89bc5a712067cccf08f03a8800d4e479 /test
parent8807b0dc96cbb0d0b72cddae2f41dd163589b7cc (diff)
[YARP] Implement compilation for Regex / InterpolatedRegex (#8396)
Notes
Notes: Merged-By: jemmaissroff
Diffstat (limited to 'test')
-rw-r--r--test/yarp/compiler_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/yarp/compiler_test.rb b/test/yarp/compiler_test.rb
index f7f8618ada..ea8c390362 100644
--- a/test/yarp/compiler_test.rb
+++ b/test/yarp/compiler_test.rb
@@ -168,6 +168,12 @@ module YARP
assert_equal "1", compile('$yct = 1; "#$yct"')
end
+ def test_InterpolatedRegularExpressionNode
+ assert_equal /1 1 1/, compile('$yct = 1; /1 #$yct 1/')
+ assert_equal /1 3 1/, compile('/1 #{1 + 2} 1/')
+ assert_equal /1 2 3 1/, compile('/1 #{"2"} #{1 + 2} 1/')
+ end
+
def test_InterpolatedStringNode
assert_equal "1 1 1", compile('$yct = 1; "1 #$yct 1"')
assert_equal "1 3 1", compile('"1 #{1 + 2} 1"')
@@ -183,6 +189,10 @@ module YARP
assert_equal "100", compile('`printf "100"`')
end
+ def test_RegularExpressionNode
+ assert_equal /yct/, compile('/yct/')
+ end
+
def test_StringConcatNode
# assert_equal "YARP::CompilerTest", compile('"YARP" "::" "CompilerTest"')
end