about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/fetchurl.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/fetchurl.sh b/tests/fetchurl.sh
index 495d42a2568a..b6fa3a27edd8 100644
--- a/tests/fetchurl.sh
+++ b/tests/fetchurl.sh
@@ -2,12 +2,14 @@ source common.sh
 
 clearStore
 
+# Test fetching a flat file.
 hash=$(nix-hash --flat --type sha256 ./fetchurl.sh)
 
 outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$(pwd)/fetchurl.sh --argstr sha256 $hash --no-out-link)
 
 cmp $outPath fetchurl.sh
 
+# Test unpacking a NAR.
 rm -rf $TEST_ROOT/archive
 mkdir -p $TEST_ROOT/archive
 cp ./fetchurl.sh $TEST_ROOT/archive
@@ -25,3 +27,15 @@ echo $outPath | grep -q 'xyzzy'
 
 test -x $outPath/fetchurl.sh
 test -L $outPath/symlink
+
+nix-store --delete $outPath
+
+# Test unpacking a compressed NAR.
+narxz=$TEST_ROOT/archive.nar.xz
+rm -f $narxz
+xz --keep $nar
+outPath=$(nix-build '<nix/fetchurl.nix>' --argstr url file://$narxz --argstr sha256 $hash \
+          --arg unpack true --argstr name xyzzy --no-out-link)
+
+test -x $outPath/fetchurl.sh
+test -L $outPath/symlink