Use dedicated assertions for warnings
This commit is contained in:
parent
77f963004f
commit
8c02084ac8
@ -763,41 +763,23 @@ EXPECTED
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_pack_garbage
|
def test_pack_garbage
|
||||||
verbose = $VERBOSE
|
assert_warn("") do
|
||||||
$VERBOSE = false
|
|
||||||
|
|
||||||
assert_silent do
|
|
||||||
assert_equal "\000", [0].pack("*U")
|
assert_equal "\000", [0].pack("*U")
|
||||||
end
|
end
|
||||||
|
|
||||||
$VERBOSE = true
|
assert_warning(%r%unknown pack directive '\*' in '\*U'$%) do
|
||||||
|
|
||||||
_, err = capture_output do
|
|
||||||
assert_equal "\000", [0].pack("*U")
|
assert_equal "\000", [0].pack("*U")
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_match %r%unknown pack directive '\*' in '\*U'$%, err
|
|
||||||
ensure
|
|
||||||
$VERBOSE = verbose
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_unpack_garbage
|
def test_unpack_garbage
|
||||||
verbose = $VERBOSE
|
assert_warn("") do
|
||||||
$VERBOSE = false
|
|
||||||
|
|
||||||
assert_silent do
|
|
||||||
assert_equal [0], "\000".unpack("*U")
|
assert_equal [0], "\000".unpack("*U")
|
||||||
end
|
end
|
||||||
|
|
||||||
$VERBOSE = true
|
assert_warning(%r%unknown unpack directive '\*' in '\*U'$%) do
|
||||||
|
|
||||||
_, err = capture_output do
|
|
||||||
assert_equal [0], "\000".unpack("*U")
|
assert_equal [0], "\000".unpack("*U")
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_match %r%unknown unpack directive '\*' in '\*U'$%, err
|
|
||||||
ensure
|
|
||||||
$VERBOSE = verbose
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_invalid_warning
|
def test_invalid_warning
|
||||||
|
Loading…
x
Reference in New Issue
Block a user