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/is_built-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/is_built-test.sh')
-rw-r--r-- | test/is_built-test.sh | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/test/is_built-test.sh b/test/is_built-test.sh index c547b93..e76ffc0 100644 --- a/test/is_built-test.sh +++ b/test/is_built-test.sh @@ -16,30 +16,30 @@ it_displays_help() { LANG=C is_built -h >$tmpdir/stdout 2>$tmpdir/stderr [[ "$(sed 1q $tmpdir/stdout)" =~ Usage:.* ]] - [[ -z "$(cat $tmpdir/stderr)" ]] + empty $tmpdir/stderr } it_fails_with_0_args() { is_built >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? [[ $stat -gt 1 ]] - [[ -z "$(cat $tmpdir/stdout)" ]] - [[ -n "$(cat $tmpdir/stderr)" ]] + empty $tmpdir/stdout + ! empty $tmpdir/stderr } it_succeeds_with_1_arg() { is_built sh >$tmpdir/stdout 2>$tmpdir/stderr - [[ -z "$(cat $tmpdir/stdout)" ]] - [[ -z "$(cat $tmpdir/stderr)" ]] + empty $tmpdir/stdout + empty $tmpdir/stderr } it_returns_1_for_non_existent_package() { is_built phony-ne-package 100 >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? [[ $stat == 1 ]] - [[ -z "$(cat $tmpdir/stdout)" ]] - [[ -z "$(cat $tmpdir/stderr)" ]] + empty $tmpdir/stdout + empty $tmpdir/stderr } it_returns_1_for_future_packages() { @@ -47,14 +47,14 @@ it_returns_1_for_future_packages() { is_built emacs 100 >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? [[ $stat == 1 ]] - [[ -z "$(cat $tmpdir/stdout)" ]] - [[ -z "$(cat $tmpdir/stderr)" ]] + empty $tmpdir/stdout + empty $tmpdir/stderr } it_returns_0_for_past_packages() { # If emacs ever goes rapid release, we might need to change this :P is_built emacs 1 >$tmpdir/stdout 2>$tmpdir/stderr - [[ -z "$(cat $tmpdir/stdout)" ]] - [[ -z "$(cat $tmpdir/stderr)" ]] + empty $tmpdir/stdout + empty $tmpdir/stderr } |