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.nix10
1 files changed, 10 insertions, 0 deletions
diff --git a/nix/readTree/tests/default.nix b/nix/readTree/tests/default.nix
index 676cc9e6d988..f3cab2844785 100644
--- a/nix/readTree/tests/default.nix
+++ b/nix/readTree/tests/default.nix
@@ -79,7 +79,17 @@ let
       (import ./test-tree-traversal/default-nix/can-be-drv/default.nix {}))
   ];
 
+  # these each call readTree themselves because the throws have to happen inside assertThrows
+  wrong = it "cannot read these files and will complain" [
+    (assertThrows "this file is not a function"
+      (depot.nix.readTree {} ./test-wrong-not-a-function).not-a-function)
+    # can’t test for that, assertThrows can’t catch this error
+    # (assertThrows "this file is a function but doesn’t have dots"
+    #   (depot.nix.readTree {} ./test-wrong-no-dots).no-dots-in-function)
+  ];
+
 in runTestsuite "readTree" [
   example
   traversal-logic
+  wrong
 ]