nix-helpers: 012cc9cd7a3fa43841ed35c4f9c08b1ef7f57957
1: { die, dummyBuild, lexSort, pathsTo }:
2:
3: with rec {
4: inherit (builtins) isString;
5: simple = pathsTo isString { x = 42; };
6: nested = pathsTo isString { x = { y = { z = "hello"; }; }; };
7: nestWant = [[ "x" "y" "z" ]];
8: multi = pathsTo isString {
9: w = "";
10: x = {
11: y = "";
12: z = "";
13: q = 42;
14: };
15: };
16: multiWant = [ [ "w" ] [ "x" "y" ] [ "x" "z" ] ];
17: }; {
18: check = assert simple == [ ] || die {
19: error = "Shouldn't have paths when nothing matches";
20: result = simple;
21: };
22: assert nested == nestWant || die {
23: error = "Paths to nested value didn't match expected";
24: expected = nestWant;
25: result = nested;
26: };
27: assert lexSort multi == multiWant || die {
28: error = "pathsTo failed when multiple results expected";
29: expected = multiWant;
30: result = lexSort multi;
31: };
32: dummyBuild "pathsTo-check";
33: }
Generated by git2html.