diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-11-06 08:54:32 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2019-11-06 08:54:32 +0900 |
commit | aa94245a09887f95bc0cd353b3462108d76d13ed (patch) | |
tree | 3699f413121b565a909292fca077441dab06f0f6 /test | |
parent | 7460c884fb06a2c50a4a771761003ed78c8b28ce (diff) | |
download | ruby-aa94245a09887f95bc0cd353b3462108d76d13ed.tar.gz |
Undefine MatchData.allocate [Feature #16294]
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_regexp.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb index 05099d3638..a1d49c595a 100644 --- a/test/ruby/test_regexp.rb +++ b/test/ruby/test_regexp.rb @@ -1002,6 +1002,8 @@ class TestRegexp < Test::Unit::TestCase assert_raise(TypeError) { Regexp.allocate.names } assert_raise(TypeError) { Regexp.allocate.named_captures } + assert_not_respond_to(MatchData, :allocate) +=begin assert_raise(TypeError) { MatchData.allocate.hash } assert_raise(TypeError) { MatchData.allocate.regexp } assert_raise(TypeError) { MatchData.allocate.names } @@ -1024,6 +1026,7 @@ class TestRegexp < Test::Unit::TestCase assert_raise(TypeError) { $` } assert_raise(TypeError) { $' } assert_raise(TypeError) { $+ } +=end end def test_unicode @@ -1093,7 +1096,9 @@ class TestRegexp < Test::Unit::TestCase assert_equal(a, b, '[ruby-core:24748]') h = {a => 42} assert_equal(42, h[b], '[ruby-core:24748]') +=begin assert_match(/#<TestRegexp::MatchData_\u{3042}:/, MatchData_A.allocate.inspect) +=end h = /^(?<@time>\d+): (?<body>.*)/.match("123456: hoge fuga") assert_equal("123456", h["@time"]) |