1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test/ruby/test_regexp.rb

(TestRegexp#test_options_in_look_behind)
  (TestRegexp#assert_match_at): Parse regexps in run time rather
  than in compile time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41793 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
knu 2013-07-05 07:24:10 +00:00
parent a62ee369a1
commit b3c40d5b9b
2 changed files with 17 additions and 9 deletions

View file

@ -1,4 +1,4 @@
Fri Jul 5 16:01:21 2013 Akinori MUSHA <knu@iDaemons.org> Fri Jul 5 16:21:56 2013 Akinori MUSHA <knu@iDaemons.org>
* test/ruby/test_regexp.rb * test/ruby/test_regexp.rb
(TestRegexp#test_options_in_look_behind) (TestRegexp#test_options_in_look_behind)
@ -8,6 +8,11 @@ Fri Jul 5 16:01:21 2013 Akinori MUSHA <knu@iDaemons.org>
interpolate a regexp into another in the middle of a look-behind interpolate a regexp into another in the middle of a look-behind
pattern. cf. https://github.com/k-takata/Onigmo/pull/17 pattern. cf. https://github.com/k-takata/Onigmo/pull/17
* test/ruby/test_regexp.rb
(TestRegexp#test_options_in_look_behind)
(TestRegexp#assert_match_at): Parse regexps in run time rather
than in compile time.
Fri Jul 5 12:14:40 2013 NAKAMURA Usaku <usa@ruby-lang.org> Fri Jul 5 12:14:40 2013 NAKAMURA Usaku <usa@ruby-lang.org>
* test/ruby/test_rubyoptions.rb (TestRubyOptions#test_notfound): after * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_notfound): after

View file

@ -946,19 +946,22 @@ class TestRegexp < Test::Unit::TestCase
def test_options_in_look_behind def test_options_in_look_behind
assert_nothing_raised { assert_nothing_raised {
assert_match_at(/(?<=(?i)ab)cd/, "ABcd", [[2,4]]) assert_match_at("(?<=(?i)ab)cd", "ABcd", [[2,4]])
assert_match_at(/(?<=(?i:ab))cd/, "ABcd", [[2,4]]) assert_match_at("(?<=(?i:ab))cd", "ABcd", [[2,4]])
assert_match_at(/(?<!(?i)ab)cd/, "aacd", [[2,4]]) assert_match_at("(?<!(?i)ab)cd", "aacd", [[2,4]])
assert_match_at(/(?<!(?i:ab))cd/, "aacd", [[2,4]]) assert_match_at("(?<!(?i:ab))cd", "aacd", [[2,4]])
assert_not_match(/(?<=(?i)ab)cd/, "ABCD") assert_not_match("(?<=(?i)ab)cd", "ABCD")
assert_not_match(/(?<=(?i:ab))cd/, "ABCD") assert_not_match("(?<=(?i:ab))cd", "ABCD")
assert_not_match(/(?<!(?i)ab)cd/, "ABcd") assert_not_match("(?<!(?i)ab)cd", "ABcd")
assert_not_match(/(?<!(?i:ab))cd/, "ABcd") assert_not_match("(?<!(?i:ab))cd", "ABcd")
} }
end end
# This assertion is for porting x2() tests in testpy.py of Onigmo.
def assert_match_at(re, str, positions, msg = nil) def assert_match_at(re, str, positions, msg = nil)
re = Regexp.new(re) unless re.is_a?(Regexp)
match = re.match(str) match = re.match(str)
assert_not_nil match, message(msg) { assert_not_nil match, message(msg) {