about summary refs log tree commit diff
path: root/nix/readTree/tests/default.nix
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2021-09-08T15·16+0300
committertazjin <mail@tazj.in>2021-09-08T17·58+0000
commitaedde913d125737f81e63edbc7481e886b0a4f2d (patch)
tree980613a19c4759ddbd40d28c4ad8769ea777f330 /nix/readTree/tests/default.nix
parent4c4aa8e4136dfbfd6f8c8c0979f1d91236a44346 (diff)
refactor(readTree): Pass all readTree parameters as function args r/2824
Instead of having a mix of depot-passed args (for the filter) and args
to the readTree function itself, make everything a single attribute
set of arguments passed to the function.

This also makes it a bit easier to extend this in the future.

Change-Id: I633c1fc96026d137b451bb604ef92be32571a0f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/3498
Tested-by: BuildkiteCI
Reviewed-by: grfn <grfn@gws.fyi>
Diffstat (limited to '')
-rw-r--r--nix/readTree/tests/default.nix15
1 files changed, 12 insertions, 3 deletions
diff --git a/nix/readTree/tests/default.nix b/nix/readTree/tests/default.nix
index f3cab28447..06d4a12dd0 100644
--- a/nix/readTree/tests/default.nix
+++ b/nix/readTree/tests/default.nix
@@ -8,7 +8,10 @@ let
     assertThrows
     ;
 
-  tree-ex = depot.nix.readTree {} ./test-example;
+  tree-ex = depot.nix.readTree {
+    path = ./test-example;
+    args = {};
+  };
 
   example = it "corresponds to the README example" [
     (assertEq "third_party attrset"
@@ -32,7 +35,10 @@ let
       "roquefort")
   ];
 
-  tree-tl = depot.nix.readTree {} ./test-tree-traversal;
+  tree-tl = depot.nix.readTree {
+    path = ./test-tree-traversal;
+    args = {};
+  };
 
   traversal-logic = it "corresponds to the traversal logic in the README" [
     (assertEq "skip subtree default.nix is read"
@@ -82,7 +88,10 @@ let
   # 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)
+      (depot.nix.readTree {
+        path = ./test-wrong-not-a-function;
+        args = {};
+      }).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)