summaryrefslogtreecommitdiff
path: root/test/librechroot-test.sh
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-09-30 12:06:49 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-09-30 12:07:44 -0400
commit505cf3ea3c09b390a57c715e47b65fea764d726d (patch)
tree1d6410c460e2df89fe64fe45e11df9dbbffbf647 /test/librechroot-test.sh
parent3473a80a47f2cadc729f3be05fa7485ae5b12e22 (diff)
test-common.sh: add an empty() routine to check if a file is empty, use it
Diffstat (limited to 'test/librechroot-test.sh')
-rw-r--r--test/librechroot-test.sh16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/librechroot-test.sh b/test/librechroot-test.sh
index 76afb56..90d0adc 100644
--- a/test/librechroot-test.sh
+++ b/test/librechroot-test.sh
@@ -36,22 +36,22 @@ it_displays_help_as_normal_user() {
LANG=C librechroot help >$tmpdir/stdout 2>$tmpdir/stderr
[[ "$(sed 1q $tmpdir/stdout)" =~ Usage:.* ]]
- [[ -z "$(cat $tmpdir/stderr)" ]]
+ empty $tmpdir/stderr
}
it_otherwise_fails_as_normal_user() {
librechroot run true >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
[[ $stat != 0 ]]
- [[ -z "$(cat $tmpdir/stdout)" ]]
- [[ -n "$(cat $tmpdir/stderr)" ]]
+ empty $tmpdir/stdout
+ ! empty $tmpdir/stderr
}
it_displays_help_and_fails_with_0_args() {
LANG=C librechroot >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
[[ $stat != 0 ]]
- [[ -z "$(cat $tmpdir/stdout)" ]]
+ empty $tmpdir/stdout
[[ "$(sed 1q $tmpdir/stderr)" =~ Usage:.* ]]
}
@@ -61,8 +61,8 @@ it_fails_for_unknown_commands() {
testsudo librechroot phony >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
[[ $stat != 0 ]]
- [[ -z "$(cat $tmpdir/stdout)" ]]
- [[ -n "$(cat $tmpdir/stderr)" ]]
+ empty $tmpdir/stdout
+ ! empty $tmpdir/stderr
}
# requires sudo so we know it's not failing because it needs root
@@ -71,6 +71,6 @@ it_fails_for_unknown_flags() {
testsudo librechroot -q >$tmpdir/stdout 2>$tmpdir/stderr || stat=$?
[[ $stat != 0 ]]
- [[ -z "$(cat $tmpdir/stdout)" ]]
- [[ -n "$(cat $tmpdir/stderr)" ]]
+ empty $tmpdir/stdout
+ ! empty $tmpdir/stderr
}