1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Imported minitest 1.3.1 r4532.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ryan 2009-01-20 23:26:55 +00:00
parent bd3cdcf394
commit 7bcd50555b
3 changed files with 21 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Wed Jan 21 08:22:04 2009 Ryan Davis <ryand-ruby@zenspider.com>
* lib/minitest/*.rb: Imported minitest 1.3.1 r4532.
* test/minitest/*.rb: ditto.
Tue Jan 20 20:16:21 2009 Tanaka Akira <akr@fsij.org> Tue Jan 20 20:16:21 2009 Tanaka Akira <akr@fsij.org>
* ext/socket/socket.c (socket_s_list_ip_address): new method. * ext/socket/socket.c (socket_s_list_ip_address): new method.

View file

@ -96,6 +96,8 @@ module MiniTest
def assert_includes collection, obj, msg = nil def assert_includes collection, obj, msg = nil
msg = message(msg) { "Expected #{mu_pp(collection)} to include #{mu_pp(obj)}" } msg = message(msg) { "Expected #{mu_pp(collection)} to include #{mu_pp(obj)}" }
flip = (obj.respond_to? :include?) && ! (collection.respond_to? :include?) # HACK for specs
obj, collection = collection, obj if flip
assert_respond_to collection, :include? assert_respond_to collection, :include?
assert collection.include?(obj), msg assert collection.include?(obj), msg
end end
@ -261,6 +263,8 @@ module MiniTest
def refute_includes collection, obj, msg = nil def refute_includes collection, obj, msg = nil
msg = message(msg) { "Expected #{mu_pp(collection)} to not include #{mu_pp(obj)}" } msg = message(msg) { "Expected #{mu_pp(collection)} to not include #{mu_pp(obj)}" }
flip = (obj.respond_to? :include?) && ! (collection.respond_to? :include?) # HACK for specs
obj, collection = collection, obj if flip
assert_respond_to collection, :include? assert_respond_to collection, :include?
refute collection.include?(obj), msg refute collection.include?(obj), msg
end end

View file

@ -154,4 +154,16 @@ describe MiniTest::Spec do
1.wont_be_same_as(2).must_equal false 1.wont_be_same_as(2).must_equal false
proc { 1.wont_be_same_as 1 }.must_raise MiniTest::Assertion proc { 1.wont_be_same_as 1 }.must_raise MiniTest::Assertion
end end
it "needs to be sensible about must_include order" do
@assertion_count = 6
[1, 2, 3].must_include(2).must_equal true
proc { [1, 2, 3].must_include 5 }.must_raise MiniTest::Assertion
end
it "needs to be sensible about wont_include order" do
@assertion_count = 6
[1, 2, 3].wont_include(5).must_equal false
proc { [1, 2, 3].wont_include 2 }.must_raise MiniTest::Assertion
end
end end