test(nix/readTree): test marking behavior of readTree
This ensures in a simple example that __readTree and __readTreeChildren are populated correctly. Change-Id: I69a46b2ddde0d1f9bf0dff1c4780f033ac8fc27a Reviewed-on: https://cl.tvl.fyi/c/depot/+/3655 Tested-by: BuildkiteCI Reviewed-by: tazjin <mail@tazj.in>
This commit is contained in:
parent
348cf5ae73
commit
9dae5acf64
5 changed files with 35 additions and 0 deletions
|
@ -97,8 +97,31 @@ let
|
||||||
# (depot.nix.readTree {} ./test-wrong-no-dots).no-dots-in-function)
|
# (depot.nix.readTree {} ./test-wrong-no-dots).no-dots-in-function)
|
||||||
];
|
];
|
||||||
|
|
||||||
|
read-markers = depot.nix.readTree {
|
||||||
|
path = ./test-marker;
|
||||||
|
args = {};
|
||||||
|
};
|
||||||
|
|
||||||
|
assertMarkerByPath = path:
|
||||||
|
assertEq "${lib.concatStringsSep "." path} is marked correctly"
|
||||||
|
(lib.getAttrFromPath path read-markers).__readTree path;
|
||||||
|
|
||||||
|
markers = it "marks nodes correctly" [
|
||||||
|
(assertMarkerByPath [ "directory-marked" ])
|
||||||
|
(assertMarkerByPath [ "directory-marked" "nested" ])
|
||||||
|
(assertMarkerByPath [ "file-children" "one" ])
|
||||||
|
(assertMarkerByPath [ "file-children" "two" ])
|
||||||
|
(assertEq "nix file children are marked correctly"
|
||||||
|
read-markers.file-children.__readTreeChildren [ "one" "two" ])
|
||||||
|
(assertEq "directory children are marked correctly"
|
||||||
|
read-markers.directory-marked.__readTreeChildren [ "nested" ])
|
||||||
|
(assertEq "absence of children is marked"
|
||||||
|
read-markers.directory-marked.nested.__readTreeChildren [ ])
|
||||||
|
];
|
||||||
|
|
||||||
in runTestsuite "readTree" [
|
in runTestsuite "readTree" [
|
||||||
example
|
example
|
||||||
traversal-logic
|
traversal-logic
|
||||||
wrong
|
wrong
|
||||||
|
markers
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{}
|
3
nix/readTree/tests/test-marker/file-children/one.nix
Normal file
3
nix/readTree/tests/test-marker/file-children/one.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{}
|
3
nix/readTree/tests/test-marker/file-children/two.nix
Normal file
3
nix/readTree/tests/test-marker/file-children/two.nix
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{ ... }:
|
||||||
|
|
||||||
|
{}
|
Loading…
Reference in a new issue