about summary refs log tree commit diff
path: root/nix/readTree/tests/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nix/readTree/tests/default.nix')
-rw-r--r--nix/readTree/tests/default.nix37
1 files changed, 37 insertions, 0 deletions
diff --git a/nix/readTree/tests/default.nix b/nix/readTree/tests/default.nix
new file mode 100644
index 000000000000..e591dc9fe94d
--- /dev/null
+++ b/nix/readTree/tests/default.nix
@@ -0,0 +1,37 @@
+{ depot, lib, ... }:
+
+let
+  inherit (depot.nix.runTestsuite)
+    runTestsuite
+    it
+    assertEq
+    assertThrows
+    ;
+
+  tree-ex = depot.nix.readTree {} ./test-example;
+
+  example = it "corresponds to the example" [
+    (assertEq "third_party attrset"
+      (lib.isAttrs tree-ex.third_party
+      && (! lib.isDerivation tree-ex.third_party))
+      true)
+    (assertEq "third_party attrset other attribute"
+      tree-ex.third_party.favouriteColour
+      "orange")
+    (assertEq "rustpkgs attrset aho-corasick"
+      tree-ex.third_party.rustpkgs.aho-corasick
+      "aho-corasick")
+    (assertEq "rustpkgs attrset serde"
+      tree-ex.third_party.rustpkgs.serde
+      "serde")
+    (assertEq "tools cheddear"
+      "cheddar"
+      tree-ex.tools.cheddar)
+    (assertEq "tools roquefort"
+      tree-ex.tools.roquefort
+      "roquefort")
+  ];
+
+in runTestsuite "readTree" [
+  example
+]