summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/ruby/test_regexp.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 549b21c84e..d17a125444 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -1232,6 +1232,14 @@ class TestRegexp < Test::Unit::TestCase
end;
end
+ def test_absent
+ assert_equal(0, /(?~(a|c)c)/ =~ "abb")
+ assert_equal("abb", $&)
+
+ assert_equal(0, /\/\*((?~\*\/))\*\// =~ "/*abc*def/xyz*/ /* */")
+ assert_equal("abc*def/xyz", $1)
+ end
+
# This assertion is for porting x2() tests in testpy.py of Onigmo.
def assert_match_at(re, str, positions, msg = nil)
re = Regexp.new(re) unless re.is_a?(Regexp)