diff options
author | ntalbott <ntalbott@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-08 17:06:11 +0000 |
---|---|---|
committer | ntalbott <ntalbott@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-08 17:06:11 +0000 |
commit | 152380a87c7f26445141e845eaab95fe20c42918 (patch) | |
tree | 871f5125a953c2462bfb4a01567315db31fff5fc | |
parent | c103eb6793b69d98a5e135ad4ddef09db364ec5b (diff) | |
download | ruby-152380a87c7f26445141e845eaab95fe20c42918.tar.gz |
* 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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | lib/test/unit/assertions.rb | 3 | ||||
-rw-r--r-- | test/testunit/test_assertions.rb | 11 |
3 files changed, 18 insertions, 4 deletions
@@ -1,3 +1,11 @@ +Sat Nov 9 02:05:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org> + + * 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 <nahi@ruby-lang.org> * 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("<nil> expected to not be nil."){assert_not_nil(nil)} + check_fails("message.\n<nil> 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?<Class>.}) { + check_fails(%Q{<"string">\nexpected to be kind_of?\n<Class> but was\n<String>.}) { assert_kind_of(Class, "string") } - check_fails(%Q{failed assert_kind_of.\n<"string">\nexpected to be kind_of?<Class>.}) { + check_fails(%Q{failed assert_kind_of.\n<"string">\nexpected to be kind_of?\n<Class> but was\n<String>.}) { assert_kind_of(Class, "string", "failed assert_kind_of") } end |