ruby-changes:4757
From: ko1@a...
Date: Thu, 1 May 2008 18:12:20 +0900 (JST)
Subject: [ruby-changes:4757] akr - Ruby:r16251 (trunk): add tests for and .
akr 2008-05-01 18:12:09 +0900 (Thu, 01 May 2008)
New Revision: 16251
Modified files:
trunk/test/ruby/test_hash.rb
trunk/test/ruby/test_regexp.rb
Log:
add tests for [ruby-dev:34556] and [ruby-dev:34555].
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_hash.rb?r1=16251&r2=16250&diff_format=u
http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_regexp.rb?r1=16251&r2=16250&diff_format=u
Index: test/ruby/test_regexp.rb
===================================================================
--- test/ruby/test_regexp.rb (revision 16250)
+++ test/ruby/test_regexp.rb (revision 16251)
@@ -250,6 +250,10 @@
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)
Index: test/ruby/test_hash.rb
===================================================================
--- test/ruby/test_hash.rb (revision 16250)
+++ test/ruby/test_hash.rb (revision 16251)
@@ -671,6 +671,9 @@
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
--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/