mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/test/unit/assertions.rb: fixed #assert_no_match message.
* test/testunit/test_assertions.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5079 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
062616677f
commit
6e4b8e19d7
3 changed files with 16 additions and 11 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
Tue Dec 2 04:22:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/test/unit/assertions.rb: fixed #assert_no_match message.
|
||||||
|
|
||||||
|
* test/testunit/test_assertions.rb: ditto.
|
||||||
|
|
||||||
Tue Dec 2 00:43:00 2003 why the lucky stiff <why@ruby-lang.org>
|
Tue Dec 2 00:43:00 2003 why the lucky stiff <why@ruby-lang.org>
|
||||||
|
|
||||||
* ext/syck/syck.c: string buffering bug. decrementing by full
|
* ext/syck/syck.c: string buffering bug. decrementing by full
|
||||||
|
|
|
@ -229,7 +229,7 @@ EOT
|
||||||
public
|
public
|
||||||
def assert_no_match(regexp, string, message="")
|
def assert_no_match(regexp, string, message="")
|
||||||
_wrap_assertion do
|
_wrap_assertion do
|
||||||
assert_instance_of(Regexp, regexp, "The first argument to assert_does_not_match should be a Regexp.")
|
assert_instance_of(Regexp, regexp, "The first argument to assert_no_match should be a Regexp.")
|
||||||
full_message = build_message(message, "<?> expected to not match\n<?>.", regexp, string)
|
full_message = build_message(message, "<?> expected to not match\n<?>.", regexp, string)
|
||||||
assert_block(full_message) { regexp !~ string }
|
assert_block(full_message) { regexp !~ string }
|
||||||
end
|
end
|
||||||
|
|
|
@ -336,18 +336,17 @@ module Test
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_assert_no_match
|
def test_assert_no_match
|
||||||
check_nothing_fails {
|
check_nothing_fails{assert_no_match(/sling/, "string")}
|
||||||
assert_no_match(/sling/, "string")
|
check_nothing_fails{assert_no_match(/sling/, "string", "message")}
|
||||||
}
|
check_fails(%Q{The first argument to assert_no_match should be a Regexp.\n<"asdf"> expected to be an instance of\n<Regexp> but was\n<String>.}) do
|
||||||
check_nothing_fails {
|
assert_no_match("asdf", "asdf")
|
||||||
assert_no_match(/sling/, "string", "message")
|
end
|
||||||
}
|
check_fails(%Q{</string/> expected to not match\n<"string">.}) do
|
||||||
check_fails(%Q{</string/> expected to not match\n<"string">.}) {
|
|
||||||
assert_no_match(/string/, "string")
|
assert_no_match(/string/, "string")
|
||||||
}
|
end
|
||||||
check_fails(%Q{message.\n</string/> expected to not match\n<"string">.}) {
|
check_fails(%Q{message.\n</string/> expected to not match\n<"string">.}) do
|
||||||
assert_no_match(/string/, "string", "message")
|
assert_no_match(/string/, "string", "message")
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_assert_throws
|
def test_assert_throws
|
||||||
|
|
Loading…
Add table
Reference in a new issue