blob: f2fd457bbf3c01e5f45a67a5886a1a51e5cafe80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#!/usr/bin/env roundup
describe libreblacklist
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-reason <<<skype)"; [[ -z $v ]]
}
it_works_with_everything_set() {
line='linux:linux-libre:nonfree blobs and firmwares'
v="$(libreblacklist normalize <<<"$line")"; [[ $v == "$line" ]]
v="$(libreblacklist get-pkg <<<"$line")"; [[ $v == 'linux' ]]
v="$(libreblacklist get-rep <<<"$line")"; [[ $v == 'linux-libre' ]]
v="$(libreblacklist get-reason <<<"$line")"; [[ $v == 'nonfree blobs and firmwares' ]]
}
it_normalizes_correctly() {
v="$(libreblacklist normalize <<<pkg)"; [[ $v == 'pkg::' ]]
v="$(libreblacklist normalize <<<pkg:)"; [[ $v == 'pkg::' ]]
v="$(libreblacklist normalize <<<pkg::)"; [[ $v == 'pkg::' ]]
v="$(libreblacklist normalize <<<pkg:rep)"; [[ $v == 'pkg:rep:' ]]
v="$(libreblacklist normalize <<<pkg:rep:)"; [[ $v == 'pkg:rep:' ]]
v="$(libreblacklist normalize <<<pkg:rep:reason)"; [[ $v == 'pkg:rep:reason' ]]
v="$(libreblacklist normalize <<<pkg:rep:reason:)"; [[ $v == 'pkg:rep:reason:' ]]
}
it_works_with_colons_in_reason() {
line='package:replacement: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-reason <<<"$line")"; [[ $v == 'my:reason' ]]
}
# TODO: test blacklist-update, but I don't want tests to use network
|