From d9fbe3e20860be305c9d42945b4d0ef73067007e Mon Sep 17 00:00:00 2001 From: Silvan Mosberger <contact@infinisil.com> Date: Thu, 16 Dec 2021 19:59:13 +0100 Subject: [PATCH] Add a test case for builtins.groupBy --- tests/lang/eval-okay-groupBy.exp | 1 + tests/lang/eval-okay-groupBy.nix | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 tests/lang/eval-okay-groupBy.exp create mode 100644 tests/lang/eval-okay-groupBy.nix diff --git a/tests/lang/eval-okay-groupBy.exp b/tests/lang/eval-okay-groupBy.exp new file mode 100644 index 000000000..bfca5652a --- /dev/null +++ b/tests/lang/eval-okay-groupBy.exp @@ -0,0 +1 @@ +{ "1" = [ 9 ]; "2" = [ 8 ]; "3" = [ 13 29 ]; "4" = [ 3 4 10 11 17 18 ]; "5" = [ 0 23 26 28 ]; "6" = [ 1 12 21 27 30 ]; "7" = [ 7 22 ]; "8" = [ 14 ]; "9" = [ 19 ]; b = [ 16 25 ]; c = [ 24 ]; d = [ 2 ]; e = [ 5 6 15 31 ]; f = [ 20 ]; } diff --git a/tests/lang/eval-okay-groupBy.nix b/tests/lang/eval-okay-groupBy.nix new file mode 100644 index 000000000..862d89dbd --- /dev/null +++ b/tests/lang/eval-okay-groupBy.nix @@ -0,0 +1,5 @@ +with import ./lib.nix; + +builtins.groupBy (n: + builtins.substring 0 1 (builtins.hashString "sha256" (toString n)) +) (range 0 31)