diff options
author | sorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-26 07:58:28 +0000 |
---|---|---|
committer | sorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-26 07:58:28 +0000 |
commit | c4b4e77c72b42f0a69c6a825954ec768d1b2375b (patch) | |
tree | 82428b01d29a336f150a95c1655410260bf5c078 /test/ruby/test_string.rb | |
parent | 26f7f7da272cfa4ad4a81758d4caef6528b6efbd (diff) | |
download | ruby-c4b4e77c72b42f0a69c6a825954ec768d1b2375b.tar.gz |
* insns.def (opt_regexpmatch2): Check String#=~ hasn't overridden
before calling rb_reg_match().
* test/ruby/test_string.rb: Test for above.
* vm.c (vm_init_redefined_flag): Add BOP flag for String#=~
[ruby-core:57385] [Bug #8953]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43052 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r-- | test/ruby/test_string.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 4520464105..694d122372 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -2256,6 +2256,18 @@ class TestString < Test::Unit::TestCase assert_equal Encoding::UTF_8, a.encoding assert_equal Encoding::US_ASCII, b.encoding end + + def test_eq_tilde_can_be_overridden + assert_in_out_err([], <<-RUBY, ["foo"], []) + class String + def =~(str) + "foo" + end + end + + puts "" =~ // + RUBY + end end class TestString2 < TestString |