diff options
author | Vincent Ambo <mail@tazj.in> | 2022-10-02T17·02+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-10-03T17·39+0000 |
commit | 0537d88078bcc547e8459463c581dfdb4bef2f81 (patch) | |
tree | e96b414c32d5e9ece404419faba1c648199496db /tvix/eval/src/tests/tvix_tests/eval-okay-builtins-any.nix | |
parent | 844d28894978ff5522cb57947edbeb8f28dad309 (diff) |
feat(tvix/eval): implement `builtins.any` r/5024
Change-Id: I640ee20e7c0a68c4e024a577e429fed9b3a49ece Reviewed-on: https://cl.tvl.fyi/c/depot/+/6845 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
Diffstat (limited to 'tvix/eval/src/tests/tvix_tests/eval-okay-builtins-any.nix')
-rw-r--r-- | tvix/eval/src/tests/tvix_tests/eval-okay-builtins-any.nix | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-any.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-any.nix new file mode 100644 index 000000000000..2c659f130b65 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-any.nix @@ -0,0 +1,15 @@ +[ + (builtins.any (x: x) [ ]) + (builtins.any (x: x) [ true true true ]) + (builtins.any (x: x) [ false false false ]) + (builtins.any (x: x) [ true true false ]) + (builtins.any (x: x) [ false true true ]) + + # evaluation should short-circuit + (builtins.any (x: x) [ false true (builtins.abort "should be unreachable") ]) + + # arbitrary functions supported + (builtins.any (x: x * 2 == 42) [ ]) + (builtins.any (x: x * 2 == 42) [ 7 21 42 ]) + (builtins.any (x: x * 2 == 42) [ 1 2 3 ]) +] |