about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-09T19·41-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-07-09T19·41-0400
commit51f9f9924bcd0c30b45e370fc69dc43e6621ef61 (patch)
tree7eb8cbc42c502303822ba25bd3940f049c93d08d
parent035aa114037857b51968e62a1176f4086e2477ec (diff)
Add a test for the fetchurl function
-rw-r--r--tests/Makefile.am3
-rw-r--r--tests/fetchurl.nix6
-rw-r--r--tests/fetchurl.sh9
3 files changed, 17 insertions, 1 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f44caa4b39..517c382b19 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -9,7 +9,7 @@ TESTS = init.sh hash.sh lang.sh add.sh simple.sh dependencies.sh \
   gc-runtime.sh install-package.sh check-refs.sh filter-source.sh \
   remote-store.sh export.sh export-graph.sh negative-caching.sh \
   binary-patching.sh timeout.sh secure-drv-outputs.sh nix-channel.sh \
-  multiple-outputs.sh import-derivation.sh
+  multiple-outputs.sh import-derivation.sh fetchurl.sh
 
 XFAIL_TESTS =
 
@@ -38,6 +38,7 @@ EXTRA_DIST = $(TESTS) \
   secure-drv-outputs.nix \
   multiple-outputs.nix \
   import-derivation.nix \
+  fetchurl.nix \
   $(wildcard lang/*.nix) $(wildcard lang/*.exp) $(wildcard lang/*.exp.xml) $(wildcard lang/*.flags) $(wildcard lang/dir*/*.nix) \
   common.sh.in
 
diff --git a/tests/fetchurl.nix b/tests/fetchurl.nix
new file mode 100644
index 0000000000..2abcc039a8
--- /dev/null
+++ b/tests/fetchurl.nix
@@ -0,0 +1,6 @@
+{ filename, sha256 }:
+
+import <nix/fetchurl.nix> {
+  url = "file://${filename}";
+  inherit sha256;
+}
diff --git a/tests/fetchurl.sh b/tests/fetchurl.sh
new file mode 100644
index 0000000000..bb6180ca39
--- /dev/null
+++ b/tests/fetchurl.sh
@@ -0,0 +1,9 @@
+source common.sh
+
+clearStore
+
+hash=$(nix-hash --flat --type sha256 ./fetchurl.nix)
+
+outPath=$(nix-build ./fetchurl.nix --argstr filename $(pwd)/fetchurl.nix --argstr sha256 $hash)
+
+cmp $outPath fetchurl.nix