summaryrefslogtreecommitdiff
path: root/test/ruby/test_symbol.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_symbol.rb')
-rw-r--r--test/ruby/test_symbol.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/ruby/test_symbol.rb b/test/ruby/test_symbol.rb
index c50febf5d1..fa65dca225 100644
--- a/test/ruby/test_symbol.rb
+++ b/test/ruby/test_symbol.rb
@@ -417,8 +417,9 @@ class TestSymbol < Test::Unit::TestCase
def test_match_method
assert_equal("bar", :"foobarbaz".match(/bar/).to_s)
- o = Regexp.new('foo')
- def o.match(x, y, z); x + y + z; end
+ o = Class.new(Regexp) {
+ def match(x, y, z) = x + y + z
+ }.new('foo')
assert_equal("foobarbaz", :"foo".match(o, "bar", "baz"))
x = nil
:"foo".match(o, "bar", "baz") {|y| x = y }