mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
test_regexp.rb: test_absent
* test/ruby/test_regexp.rb (test_absent): add simple tests for absent operator. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60754 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fdb64a1a44
commit
0c467565ca
1 changed files with 8 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue