From 13c88bfcc3749d6530f1d9b8c860877188062f29 Mon Sep 17 00:00:00 2001 From: Nicolas Mattia Date: Tue, 18 Aug 2020 10:53:53 +0200 Subject: [PATCH] Add source name sanitization test --- tests/eval/default.nix | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/eval/default.nix b/tests/eval/default.nix index 8bc90a3..16c8c94 100644 --- a/tests/eval/default.nix +++ b/tests/eval/default.nix @@ -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" + ''