From e1e82671870076a73766e628f8755a1f7e0afe11 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 1 Jun 2013 11:56:57 -0600 Subject: reorganize the tests a bit --- test/lib-blacklist-test.sh | 69 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 test/lib-blacklist-test.sh (limited to 'test/lib-blacklist-test.sh') diff --git a/test/lib-blacklist-test.sh b/test/lib-blacklist-test.sh new file mode 100644 index 0000000..94f5b27 --- /dev/null +++ b/test/lib-blacklist-test.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env roundup + +describe libreblacklist + +before() { + tmpdir=$(mktemp -d --tmpdir test-libreblacklist.XXXXXXXXXXXX) + stat=0 +} + +after() { + rm -rf -- "$tmpdir" "$XDG_CACHE_HOME" "$XDG_CONFIG_HOME" +} + +it_works_with_just_pkgname() { + v="$(libreblacklist normalize <<$XDG_CONFIG_HOME/libretools/libretools.conf + + libreblacklist update >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? + + [[ $stat != 0 ]] + [[ -z "$(cat $tmpdir/stdout)" ]] + [[ -n "$(cat $tmpdir/stderr)" ]] +} + +it_fails_cat_when_there_is_no_blacklist_or_network() { + mkdir -p $XDG_CONFIG_HOME/libretools + echo "BLACKLIST='http://phony'" >$XDG_CONFIG_HOME/libretools/libretools.conf + + libreblacklist cat >$tmpdir/stdout 2>$tmpdir/stderr || stat=$? + + [[ $stat != 0 ]] + [[ -z "$(cat $tmpdir/stdout)" ]] + [[ -n "$(cat $tmpdir/stderr)" ]] +} + +# TODO: test blacklist-update, but I don't want tests to use network -- cgit v1.2.2