summaryrefslogtreecommitdiff
path: root/test/ruby/test_string.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r--test/ruby/test_string.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb
index dd403bf9d9..41d4871379 100644
--- a/test/ruby/test_string.rb
+++ b/test/ruby/test_string.rb
@@ -2512,6 +2512,7 @@ CODE
def test_match_method
assert_equal("bar", "foobarbaz".match(/bar/).to_s)
+ assert_raise(TypeError) { "".match(nil) }
o = Regexp.new('foo')
def o.match(x, y, z); x + y + z; end
@@ -2567,6 +2568,10 @@ CODE
assert_equal('backref', $&)
end
+ def test_match_p_nil
+ assert_raise(TypeError) { ''.match?(nil) }
+ end
+
def test_clear
s = "foo" * 100
s.clear