From 80e9fa38b703b3825eba1a32299884ff943ae556 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 1 Jun 2013 15:37:38 -0600 Subject: Add tests for the libreblacklist help system, make them pass. --- test/lib-blacklist-test.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'test') diff --git a/test/lib-blacklist-test.sh b/test/lib-blacklist-test.sh index 3ac8e70..1432ff6 100644 --- a/test/lib-blacklist-test.sh +++ b/test/lib-blacklist-test.sh @@ -66,4 +66,26 @@ it_fails_cat_when_there_is_no_blacklist_or_network() { [[ -n "$(cat $tmpdir/stderr)" ]] } +it_displays_help_and_fails_with_no_args() { + libreblacklist >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? + + [[ $stat != 0 ]] + [[ -z "$(cat $tmpdir/stdout)" ]] + [[ "$(sed 1q $tmpdir/stderr)" =~ 'Usage: libreblacklist ' ]] +} + +it_displays_help_when_given_h() { + libreblacklist -h >$tmpdir/stdout 2>$tmpdir/stderr + + [[ "$(sed 1q $tmpdir/stdout)" =~ 'Usage: libreblacklist ' ]] + [[ -z "$(cat $tmpdir/stderr)" ]] +} + +it_displays_help_when_given_h_cat() { + libreblacklist -h cat >$tmpdir/stdout 2>$tmpdir/stderr + + [[ "$(sed 1q $tmpdir/stdout)" =~ 'Usage: libreblacklist cat' ]] + [[ -z "$(cat $tmpdir/stderr)" ]] +} + # TODO: test blacklist-update, but I don't want tests to use network -- cgit v1.2.3-54-g00ecf