about summary refs log tree commit diff
path: root/tests/multiple-outputs.nix
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2011-12-20T17·01+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2011-12-20T17·01+0000
commit46e42c92c1444e1dd3aec871b3750bcd7391f60e (patch)
tree1713c3f6a57f264c54b687d5a3f93afaa1aed021 /tests/multiple-outputs.nix
parentb5363810bbeea37df34a5cb0051e05161630a510 (diff)
* Refactor a bit so that more tests can be added.
Diffstat (limited to 'tests/multiple-outputs.nix')
-rw-r--r--tests/multiple-outputs.nix36
1 files changed, 24 insertions, 12 deletions
diff --git a/tests/multiple-outputs.nix b/tests/multiple-outputs.nix
index e8fbf91bfa89..a4cf0caea476 100644
--- a/tests/multiple-outputs.nix
+++ b/tests/multiple-outputs.nix
@@ -1,23 +1,35 @@
 with import ./config.nix;
 
-let
+rec {
 
   a = mkDerivation {
     name = "multiple-outputs-a";
     outputs = [ "first" "second" ];
-    builder = ./multiple-outputs.a.builder.sh;
+    builder = builtins.toFile "builder.sh"
+      ''
+        mkdir $first $second
+        test -z $all
+        echo "second" > $first/file
+        echo "first" > $second/file
+      '';
     helloString = "Hello, world!";
   };
 
-in
-
-assert a.second.helloString == "Hello, world!";
+  b = mkDerivation {
+    defaultOutput = assert a.second.helloString == "Hello, world!"; a;
+    firstOutput = a.first.first;
+    secondOutput = a.second.first.first.second.second.first.second;
+    allOutputs = a.all;
+    name = "multiple-outputs-b";
+    builder = builtins.toFile "builder.sh"
+      ''
+        mkdir $out
+        test "$firstOutput $secondOutput" = "$allOutputs"
+        test "$defaultOutput" = "$firstOutput"
+        test "$(cat $firstOutput/file)" = "second"
+        test "$(cat $secondOutput/file)" = "first"
+        echo "success" > $out/file
+      '';
+  };
 
-mkDerivation {
-  defaultOutput = a;
-  firstOutput = a.first.first;
-  secondOutput = a.second.first.first.second.second.first.second;
-  allOutputs = a.all;
-  name = "multiple-outputs-b";
-  builder = ./multiple-outputs.b.builder.sh;
 }