diff --git a/ChangeLog b/ChangeLog index 79a8677eb3..709966346e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Sat Nov 9 02:05:00 2003 Nathaniel Talbott + + * lib/test/unit/assertions.rb: un-deprecated #assert_not_nil to + maintain symmetry with #assert_nil. Also added better output for + #assert_kind_of. + + * test/testunit/tc_assertions.rb: ditto. + Sat Nov 8 18:50:20 2003 NAKAMURA, Hiroshi * test/wsdl/raa/*: add new testcase for WSDL loading, parsing and diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb index fdb9632e09..c9ee8c101a 100644 --- a/lib/test/unit/assertions.rb +++ b/lib/test/unit/assertions.rb @@ -104,7 +104,7 @@ EOT def assert_kind_of(klass, object, message="") _wrap_assertion do assert(klass.kind_of?(Module), "The first parameter to assert_kind_of should be a kind_of Module.") - full_message = build_message(message, "\nexpected to be kind_of\\?.", object, klass) + full_message = build_message(message, "\nexpected to be kind_of\\?\n but was\n.", object, klass, object.class) assert_block(full_message){object.kind_of?(klass)} end end @@ -221,7 +221,6 @@ EOT # Passes if !object.nil?. public def assert_not_nil(object, message="") - warn("Assertions#assert_not_nil is deprecated and will be removed after 1.8.1. Use #assert.") full_message = build_message(message, " expected to not be nil.", object) assert_block(full_message){!object.nil?} end diff --git a/test/testunit/test_assertions.rb b/test/testunit/test_assertions.rb index ab92bcfc6d..0d79044dca 100644 --- a/test/testunit/test_assertions.rb +++ b/test/testunit/test_assertions.rb @@ -176,6 +176,13 @@ module Test } end + def test_assert_not_nil + check_nothing_fails{assert_not_nil(false)} + check_nothing_fails{assert_not_nil(false, "message")} + check_fails(" expected to not be nil."){assert_not_nil(nil)} + check_fails("message.\n expected to not be nil.") {assert_not_nil(nil, "message")} + end + def test_assert_kind_of check_nothing_fails { assert_kind_of(Module, Array) @@ -189,10 +196,10 @@ module Test check_nothing_fails { assert_kind_of(Comparable, 1) } - check_fails(%Q{<"string">\nexpected to be kind_of?.}) { + check_fails(%Q{<"string">\nexpected to be kind_of?\n but was\n.}) { assert_kind_of(Class, "string") } - check_fails(%Q{failed assert_kind_of.\n<"string">\nexpected to be kind_of?.}) { + check_fails(%Q{failed assert_kind_of.\n<"string">\nexpected to be kind_of?\n but was\n.}) { assert_kind_of(Class, "string", "failed assert_kind_of") } end