ruby-changes:48639
From: nobu <ko1@a...>
Date: Mon, 13 Nov 2017 14:46:35 +0900 (JST)
Subject: [ruby-changes:48639] nobu:r60754 (trunk): test_regexp.rb: test_absent
nobu 2017-11-13 14:46:30 +0900 (Mon, 13 Nov 2017) New Revision: 60754 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=60754 Log: test_regexp.rb: test_absent * test/ruby/test_regexp.rb (test_absent): add simple tests for absent operator. Modified files: trunk/test/ruby/test_regexp.rb Index: test/ruby/test_regexp.rb =================================================================== --- test/ruby/test_regexp.rb (revision 60753) +++ test/ruby/test_regexp.rb (revision 60754) @@ -1232,6 +1232,14 @@ class TestRegexp < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_regexp.rb#L1232 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/