feat(tvix/eval): implement builtins.any
Change-Id: I640ee20e7c0a68c4e024a577e429fed9b3a49ece Reviewed-on: https://cl.tvl.fyi/c/depot/+/6845 Tested-by: BuildkiteCI Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
parent
844d288949
commit
0537d88078
3 changed files with 30 additions and 0 deletions
|
|
@ -0,0 +1 @@
|
|||
[ false true false true true true false true false ]
|
||||
15
tvix/eval/src/tests/tvix_tests/eval-okay-builtins-any.nix
Normal file
15
tvix/eval/src/tests/tvix_tests/eval-okay-builtins-any.nix
Normal file
|
|
@ -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 ])
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue