summaryrefslogtreecommitdiff
path: root/test/ruby/test_regexp.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_regexp.rb')
-rw-r--r--test/ruby/test_regexp.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 7238e55fe1..5f07fc4fc1 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -542,17 +542,17 @@ class TestRegexp < Test::Unit::TestCase
assert(m.tainted?)
end
- def check(re, ss, fs = [])
+ def check(re, ss, fs = [], msg = nil)
re = Regexp.new(re) unless re.is_a?(Regexp)
ss = [ss] unless ss.is_a?(Array)
ss.each do |e, s|
s ||= e
- assert_match(re, s)
+ assert_match(re, s, msg)
m = re.match(s)
- assert_equal(e, m[0])
+ assert_equal(e, m[0], msg)
end
fs = [fs] unless fs.is_a?(Array)
- fs.each {|s| assert_no_match(re, s) }
+ fs.each {|s| assert_no_match(re, s, msg) }
end
def failcheck(re)
@@ -732,7 +732,7 @@ class TestRegexp < Test::Unit::TestCase
check(/\A[a-b-]\z/, %w(a b -), ["", "c"])
check('\A[a-b-&&\w]\z', %w(a b), ["", "-"])
check('\A[a-b-&&\W]\z', "-", ["", "a", "b"])
- check('\A[a-c-e]\z', %w(a b c e), %w(- d)) # is it OK?
+ check('\A[a-c-e]\z', %w(a b c e -), %w(d))
check(/\A[a-f&&[^b-c]&&[^e]]\z/, %w(a d f), %w(b c e g 0))
check(/\A[[^b-c]&&[^e]&&a-f]\z/, %w(a d f), %w(b c e g 0))
check(/\A[\n\r\t]\z/, ["\n", "\r", "\t"])
@@ -912,11 +912,11 @@ class TestRegexp < Test::Unit::TestCase
assert_equal(1, error.message.scan(/.*invalid .*escape.*/i).size, bug3539)
end
- def test_raw_hyphen_and_type_char_after_range
+ def test_raw_hyphen_and_tk_char_type_after_range
bug6853 = '[ruby-core:47115]'
begin
verbose, $VERBOSE = $VERBOSE, nil
- assert_match(/[0-1-\s]/, ' ', bug6853)
+ check(/[0-1-\s]/, [' ', '-'], [], bug6853)
ensure
$VERBOSE = verbose
end