mirror of
https://github.com/flatpak/flatpak.git
synced 2026-05-25 01:12:12 -04:00
test-override: Assert that only the expected term is negated
We weren't distinguishing here between overrides that should have been
negated (xdg-documents) and overrides that should not have been negated
(everything else).
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry picked from commit 4e3d1d8b7b)
This commit is contained in:
committed by
Simon McVittie
parent
1dbc175314
commit
74f02d1e95
@@ -597,3 +597,27 @@ trap cleanup EXIT
|
||||
if test -n "${FLATPAK_TESTS_DEBUG:-}"; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
assert_semicolon_list_contains () {
|
||||
list="$1"
|
||||
member="$2"
|
||||
|
||||
case ";$list;" in
|
||||
(*";$member;"*)
|
||||
;;
|
||||
(*)
|
||||
assert_not_reached "\"$list\" should contain \"$member\""
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
assert_not_semicolon_list_contains () {
|
||||
local list="$1"
|
||||
local member="$2"
|
||||
|
||||
case ";$list;" in
|
||||
(*";$member;"*)
|
||||
assert_not_reached "\"$list\" should not contain \"$member\""
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -173,11 +173,19 @@ ${FLATPAK} override --user --nofilesystem=xdg-documents org.test.Hello
|
||||
${FLATPAK} override --user --show org.test.Hello > override
|
||||
|
||||
assert_file_has_content override "^\[Context\]$"
|
||||
assert_file_has_content override "^filesystems=.*/media;.*$"
|
||||
assert_file_has_content override "^filesystems=.*home;.*$"
|
||||
assert_file_has_content override "^filesystems=.*xdg-documents;.*$"
|
||||
assert_file_has_content override "^filesystems=.*xdg-desktop/foo:create;.*$"
|
||||
assert_file_has_content override "^filesystems=.*xdg-config:ro;.*$"
|
||||
filesystems="$(sed -ne 's/^filesystems=//p' override)"
|
||||
assert_semicolon_list_contains "$filesystems" "/media"
|
||||
assert_not_semicolon_list_contains "$filesystems" "!/media"
|
||||
assert_semicolon_list_contains "$filesystems" "home"
|
||||
assert_not_semicolon_list_contains "$filesystems" "!home"
|
||||
assert_not_semicolon_list_contains "$filesystems" "xdg-documents"
|
||||
assert_semicolon_list_contains "$filesystems" "!xdg-documents"
|
||||
assert_semicolon_list_contains "$filesystems" "xdg-desktop/foo:create"
|
||||
assert_not_semicolon_list_contains "$filesystems" "!xdg-desktop/foo"
|
||||
assert_not_semicolon_list_contains "$filesystems" "!xdg-desktop/foo:create"
|
||||
assert_semicolon_list_contains "$filesystems" "xdg-config:ro"
|
||||
assert_not_semicolon_list_contains "$filesystems" "!xdg-config"
|
||||
assert_not_semicolon_list_contains "$filesystems" "!xdg-config:ro"
|
||||
|
||||
ok "override --filesystem"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user