diff options
Diffstat (limited to 'bin/tests/data')
-rw-r--r-- | bin/tests/data/faster_groupby.nix | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/tests/data/faster_groupby.nix b/bin/tests/data/faster_groupby.nix new file mode 100644 index 0000000..30d1031 --- /dev/null +++ b/bin/tests/data/faster_groupby.nix | |||
@@ -0,0 +1,15 @@ | |||
1 | { | ||
2 | # trivial case | ||
3 | _ = lib.groupBy (x: if x > 2 then "big" else "small") [ 1 2 3 4 5 ]; | ||
4 | |||
5 | # offer lint heuristically on this too | ||
6 | _ = nixpkgs.lib.groupBy (x: if x > 2 then "big" else "small") [ 1 2 3 4 5 ]; | ||
7 | |||
8 | # do not lint on `builtins` | ||
9 | _ = builtins.groupBy (x: x.name) [ | ||
10 | { name = "foo"; idx = 1; } | ||
11 | { name = "foo"; idx = 2; } | ||
12 | { name = "bar"; idx = 1; } | ||
13 | { name = "bar"; idx = 2; } | ||
14 | ]; | ||
15 | } | ||