diff options
author | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-30 12:06:49 -0400 |
---|---|---|
committer | Luke Shumaker <LukeShu@sbcglobal.net> | 2013-09-30 12:07:44 -0400 |
commit | 505cf3ea3c09b390a57c715e47b65fea764d726d (patch) | |
tree | 1d6410c460e2df89fe64fe45e11df9dbbffbf647 /test/lib-blacklist-test.sh | |
parent | 3473a80a47f2cadc729f3be05fa7485ae5b12e22 (diff) |
test-common.sh: add an empty() routine to check if a file is empty, use it
Diffstat (limited to 'test/lib-blacklist-test.sh')
-rw-r--r-- | test/lib-blacklist-test.sh | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/test/lib-blacklist-test.sh b/test/lib-blacklist-test.sh index c496167..c77e5ea 100644 --- a/test/lib-blacklist-test.sh +++ b/test/lib-blacklist-test.sh @@ -52,8 +52,8 @@ it_fails_update_when_there_is_no_blacklist_or_network() { libreblacklist update >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? [[ $stat != 0 ]] - [[ -z "$(cat $tmpdir/stdout)" ]] - [[ -n "$(cat $tmpdir/stderr)" ]] + empty $tmpdir/stdout + ! empty $tmpdir/stderr } it_fails_cat_when_there_is_no_blacklist_or_network() { @@ -63,8 +63,8 @@ it_fails_cat_when_there_is_no_blacklist_or_network() { libreblacklist cat >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? [[ $stat != 0 ]] - [[ -z "$(cat $tmpdir/stdout)" ]] - [[ -n "$(cat $tmpdir/stderr)" ]] + empty $tmpdir/stdout + ! empty $tmpdir/stderr } it_fails_update_when_BLACKLIST_is_unset() { @@ -74,8 +74,8 @@ it_fails_update_when_BLACKLIST_is_unset() { libreblacklist update >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? [[ $stat != 0 ]] - [[ -z "$(cat $tmpdir/stdout)" ]] - [[ -n "$(cat $tmpdir/stderr)" ]] + empty $tmpdir/stdout + ! empty $tmpdir/stderr } it_fails_cat_when_syntax_error_in_conf() { @@ -86,8 +86,8 @@ it_fails_cat_when_syntax_error_in_conf() { libreblacklist cat >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? [[ $stat != 0 ]] - [[ -z "$(cat $tmpdir/stdout)" ]] - [[ -n "$(cat $tmpdir/stderr)" ]] + empty $tmpdir/stdout + ! empty $tmpdir/stderr } it_downloads_the_blacklist_as_needed() { @@ -97,7 +97,7 @@ it_downloads_the_blacklist_as_needed() { libreblacklist cat >$tmpdir/stdout 2>$tmpdir/stderr - [[ -n "$(cat $tmpdir/stdout)" ]] + ! empty $tmpdir/stdout } it_downloads_the_blacklist_repeatedly() { @@ -113,7 +113,7 @@ it_displays_help_and_fails_with_no_args() { LANG=C libreblacklist >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? [[ $stat != 0 ]] - [[ -z "$(cat $tmpdir/stdout)" ]] + empty $tmpdir/stdout [[ "$(sed 1q $tmpdir/stderr)" =~ 'Usage: libreblacklist ' ]] } @@ -121,12 +121,12 @@ it_displays_help_when_given_h() { LANG=C libreblacklist -h >$tmpdir/stdout 2>$tmpdir/stderr [[ "$(sed 1q $tmpdir/stdout)" =~ 'Usage: libreblacklist ' ]] - [[ -z "$(cat $tmpdir/stderr)" ]] + empty $tmpdir/stderr } it_displays_help_when_given_h_cat() { LANG=C libreblacklist -h cat >$tmpdir/stdout 2>$tmpdir/stderr [[ "$(sed 1q $tmpdir/stdout)" == 'Usage: libreblacklist cat' ]] - [[ -z "$(cat $tmpdir/stderr)" ]] + empty $tmpdir/stderr } |