tests: Output errors to stderr, so they show up under "prove"
This commit is contained in:
1 parent
e52bc624ff
commit
dd37e46172
1 file changed
+4
-4
+4
-4
@@ -36,22 +36,22 @@ die () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assert_streq () {
|
assert_streq () {
|
||||||
test "$1" = "$2" || (echo "$1 != $2"; exit 1)
|
test "$1" = "$2" || (echo 1>&2 "$1 != $2"; exit 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_has_file () {
|
assert_has_file () {
|
||||||
test -f "$1" || (echo "Couldn't find '$1'"; exit 1)
|
test -f "$1" || (echo 1>&2 "Couldn't find '$1'"; exit 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_not_has_file () {
|
assert_not_has_file () {
|
||||||
if test -f "$1"; then
|
if test -f "$1"; then
|
||||||
echo "File '$1' exists"; exit 1
|
echo 1>&2 "File '$1' exists"; exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
assert_file_has_content () {
|
assert_file_has_content () {
|
||||||
if ! grep -q "$2" "$1"; then
|
if ! grep -q "$2" "$1"; then
|
||||||
echo "File '$1' doesn't match regexp '$2'"; exit 1
|
echo 1>&2 "File '$1' doesn't match regexp '$2'"; exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user