diff options
Diffstat (limited to 'test/lib-blacklist-test.sh')
-rwxr-xr-x | test/lib-blacklist-test.sh | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/test/lib-blacklist-test.sh b/test/lib-blacklist-test.sh index 742f1c2..920e99d 100755 --- a/test/lib-blacklist-test.sh +++ b/test/lib-blacklist-test.sh @@ -51,8 +51,9 @@ it_prints_urls_only_for_valid_references() { } it_fails_update_with_no_blacklist_or_network() { - mkdir -p $XDG_CONFIG_HOME/libretools - echo "BLACKLIST='phony://example.com'" >$XDG_CONFIG_HOME/libretools/libretools.conf + install -Dm644 /dev/stdin "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot + BLACKLIST='phony://example.com' + eot libreblacklist update >$tmpdir/stdout 2>$tmpdir/stderr || status=$? @@ -62,8 +63,9 @@ it_fails_update_with_no_blacklist_or_network() { } it_fails_cat_with_no_blacklist_or_network() { - mkdir -p $XDG_CONFIG_HOME/libretools - echo "BLACKLIST='phony://example.com'" >$XDG_CONFIG_HOME/libretools/libretools.conf + install -Dm644 /dev/stdin "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot + BLACKLIST='phony://example.com' + eot libreblacklist cat >$tmpdir/stdout 2>$tmpdir/stderr || status=$? @@ -73,8 +75,9 @@ it_fails_cat_with_no_blacklist_or_network() { } it_fails_update_when_BLACKLIST_is_unset() { - mkdir -p $XDG_CONFIG_HOME/libretools - echo "BLACKLIST=" >$XDG_CONFIG_HOME/libretools/libretools.conf + install -Dm644 /dev/stdin "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot + BLACKLIST= + eot libreblacklist update >$tmpdir/stdout 2>$tmpdir/stderr || status=$? @@ -84,9 +87,10 @@ it_fails_update_when_BLACKLIST_is_unset() { } it_fails_cat_when_syntax_error_in_conf() { - mkdir -p $XDG_CONFIG_HOME/libretools # there is a stray single quote in there - printf "BLACKLIST='%q\n" "${_blacklist_url}" >$XDG_CONFIG_HOME/libretools/libretools.conf + install -Dm644 /dev/stdin "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot + BLACKLIST='${_blacklist_url@Q} + eot libreblacklist cat >$tmpdir/stdout 2>$tmpdir/stderr || status=$? @@ -97,8 +101,9 @@ it_fails_cat_when_syntax_error_in_conf() { it_downloads_the_blacklist_as_needed() { require network || return 0 - mkdir -p $XDG_CONFIG_HOME/libretools - printf 'BLACKLIST=%q\n' "${_blacklist_url}" >$XDG_CONFIG_HOME/libretools/libretools.conf + install -Dm644 /dev/stdin "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot + BLACKLIST=${_blacklist_url@Q} + eot libreblacklist cat >$tmpdir/stdout 2>$tmpdir/stderr @@ -107,8 +112,9 @@ it_downloads_the_blacklist_as_needed() { it_downloads_the_blacklist_repeatedly() { require network || return 0 - mkdir -p $XDG_CONFIG_HOME/libretools - printf 'BLACKLIST=%q\n' "${_blacklist_url}" >$XDG_CONFIG_HOME/libretools/libretools.conf + install -Dm644 /dev/stdin "$XDG_CONFIG_HOME/libretools/libretools.conf" <<-eot + BLACKLIST=${_blacklist_url@Q} + eot libreblacklist update libreblacklist update |