about summary refs log tree commit diff
path: root/tests/fetchurl.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fetchurl.sh')
-rw-r--r--tests/fetchurl.sh11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/fetchurl.sh b/tests/fetchurl.sh
index 9bbf044f7329..d51d081f5e3b 100644
--- a/tests/fetchurl.sh
+++ b/tests/fetchurl.sh
@@ -18,6 +18,17 @@ outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$(pwd)/fetchurl.sh
 
 cmp $outPath fetchurl.sh
 
+# Now using an SRI hash.
+clearStore
+
+hash=$(nix hash-file ./fetchurl.sh)
+
+[[ $hash =~ ^sha512- ]]
+
+outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$(pwd)/fetchurl.sh --argstr hash $hash --no-out-link --hashed-mirrors '')
+
+cmp $outPath fetchurl.sh
+
 # Test the hashed mirror feature.
 clearStore