summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_hash.rb3
-rw-r--r--test/ruby/test_regexp.rb4
2 files changed, 7 insertions, 0 deletions
diff --git a/test/ruby/test_hash.rb b/test/ruby/test_hash.rb
index 9c2978cd8a..4c4dea84b7 100644
--- a/test/ruby/test_hash.rb
+++ b/test/ruby/test_hash.rb
@@ -671,6 +671,9 @@ class TestHash < Test::Unit::TestCase
assert_equal({1=>2, 3=>4}, Hash[[[1,2],[3,4]]])
assert_raise(ArgumentError) { Hash[0, 1, 2] }
assert_equal({1=>2, 3=>4}, Hash[1,2,3,4])
+ o = Object.new
+ def o.to_hash() {1=>2} end
+ assert_equal({1=>2}, Hash[o], "[ruby-dev:34555]")
end
def test_rehash2
diff --git a/test/ruby/test_regexp.rb b/test/ruby/test_regexp.rb
index 17fe9fa45f..45ca220529 100644
--- a/test/ruby/test_regexp.rb
+++ b/test/ruby/test_regexp.rb
@@ -250,6 +250,10 @@ class TestRegexp < Test::Unit::TestCase
assert_equal(["foo", "bar", "baz"], m.values_at(1, 2, 3))
end
+ def test_match_select
+ assert_equal(["ab", "a", "b"], /(.)(.)/.match("ab").select {|v| true }, "[ruby-dev:34556]")
+ end
+
def test_match_string
m = /(?<x>b..)/.match("foobarbaz")
assert_equal("foobarbaz", m.string)