diff options
author | Isaac David <isacdaavid@isacdaavid.info> | 2017-10-09 15:22:46 -0500 |
---|---|---|
committer | Isaac David <isacdaavid@isacdaavid.info> | 2017-10-09 15:22:46 -0500 |
commit | ce4bc72dbd590231186267c064ae1679c2ba1241 (patch) | |
tree | 118e5cc210c96b7a2bb68b4a63cf20e4c0176ad5 /test | |
parent | 37c8e4a16bf03509b032385482a1c13041adaf65 (diff) |
blacklist: implement `get-url` function from `reference` and `id` fields
The blacklist allows referring to a number of trusted bug trackers to
complement the information given in the reason field. However,
maintainable shorthand identifiers are used instead of full
URLs. Printing the latter based on the former is the job of this new
functionality.
This also introduces corresponding test cases and l10n strings
(together with translations for the `es` locale).
Diffstat (limited to 'test')
-rwxr-xr-x | test/lib-blacklist-test.sh | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/lib-blacklist-test.sh b/test/lib-blacklist-test.sh index ef99f91..202a2e2 100755 --- a/test/lib-blacklist-test.sh +++ b/test/lib-blacklist-test.sh @@ -9,14 +9,16 @@ it_works_with_just_pkgname() { v="$(libreblacklist normalize <<<skype)"; [[ $v == 'skype::::' ]] v="$(libreblacklist get-pkg <<<skype)"; [[ $v == skype ]] v="$(libreblacklist get-rep <<<skype)"; [[ -z $v ]] + v="$(libreblacklist get-url <<<skype)"; [[ -z $v ]] v="$(libreblacklist get-reason <<<skype)"; [[ -z $v ]] } it_works_with_everything_set() { - line='linux:linux-libre:fsf:id:[semifree] blobs and firmware' + line='linux:linux-libre:parabola:id:[semifree] blobs and firmware' v="$(libreblacklist normalize <<<"$line")"; [[ $v == "$line" ]] v="$(libreblacklist get-pkg <<<"$line")"; [[ $v == 'linux' ]] v="$(libreblacklist get-rep <<<"$line")"; [[ $v == 'linux-libre' ]] + v="$(libreblacklist get-url <<<"$line")"; [[ $v == 'https://labs.parabola.nu/issues/id' ]] v="$(libreblacklist get-reason <<<"$line")"; [[ $v == '[semifree] blobs and firmware' ]] } @@ -35,13 +37,19 @@ it_normalizes_correctly() { } it_works_with_colons_in_reason() { - line='package:replacement:ref:id:my:reason' + line='package:replacement:parabola:id:my:reason' v="$(libreblacklist normalize <<<"$line")"; [[ $v == "$line" ]] v="$(libreblacklist get-pkg <<<"$line")"; [[ $v == 'package' ]] v="$(libreblacklist get-rep <<<"$line")"; [[ $v == 'replacement' ]] + v="$(libreblacklist get-url <<<"$line")"; [[ $v == 'https://labs.parabola.nu/issues/id' ]] v="$(libreblacklist get-reason <<<"$line")"; [[ $v == 'my:reason' ]] } +it_prints_urls_only_for_valid_references() { + v="$(libreblacklist get-url <<<package:::id:)"; [[ -z $v ]] + v="$(libreblacklist get-url <<<package::unknown:id:)"; [[ -z $v ]] +} + 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 |