1
1
mirror of https://github.com/nmattia/niv.git synced 2024-09-18 19:07:19 +03:00

Add source name sanitization test

This commit is contained in:
Nicolas Mattia 2020-08-18 10:53:53 +02:00
parent 7abb350a10
commit 13c88bfcc3

View File

@ -40,7 +40,7 @@ let
};
in
mkTest "simple-eval" ''
mkTest "niv-override-eval" ''
update_sources '.foo = { type: "tarball", url: "foo", sha256: "whocares" }'
update_sources '."ba-r" = { type: "tarball", url: "foo", sha256: "whocares" }'
@ -71,3 +71,16 @@ mkTest "simple-eval" ''
res="$(NIV_OVERRIDE_foo="hello" eval_outPath "foo")"
eq "$res" "hello"
''
// mkTest "sanitize-source-name"
''
file=$(mktemp -d)/foo%%.bar
touch "$file"
sha=$(nix-hash --type sha256 --flat $file)
url="file://$file"
update_sources '.foo = { type: "file", url: $url, sha256: $sha}' --arg url "$url" --arg sha "$sha"
# we don't need to check the result, we just make sure this evaluates
eval_outPath "foo"
''