diff options
author | William Carroll <wpcarro@gmail.com> | 2022-09-05T18·43-0700 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-09-15T20·37+0000 |
commit | e834a2cbc47cf18d5f35bb258ccc754c54c4f4e1 (patch) | |
tree | f11441a3a3951cf4bb2224b76bbb28b4a2a3233c /tvix/eval/src/tests/tvix_tests/eval-okay-builtins-attrnames.nix | |
parent | 04503cf063340464fb4e8a185fe3b550ed48fa34 (diff) |
feat(tvix/eval): Support builtins.attrNames r/4864
Define `.len()` method on `NixAttrs` to preallocate the capacity of the result vector. Also anchor an errant comment to its context (I think). Change-Id: I268f15025d453d7b3ae1146558c80e51433dd2a8 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6546 Reviewed-by: wpcarro <wpcarro@gmail.com> Reviewed-by: sterni <sternenseemann@systemli.org> Autosubmit: wpcarro <wpcarro@gmail.com> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/tests/tvix_tests/eval-okay-builtins-attrnames.nix')
-rw-r--r-- | tvix/eval/src/tests/tvix_tests/eval-okay-builtins-attrnames.nix | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-attrnames.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-attrnames.nix new file mode 100644 index 000000000000..67f7dcee5672 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-builtins-attrnames.nix @@ -0,0 +1,13 @@ +[ + (builtins.attrNames {}) + (builtins.attrNames { foo = 1; bar = 2; baz = 3; }) + (builtins.attrNames { Foo = 1; bar = 2; Baz = 3; }) + (builtins.attrNames { + "Graham Chapman" = true; + "John Cleese" = true; + "Terry Gilliam" = true; + "Eric Idle" = true; + "Terry Jones" = true; + "Michael Palin" = true; + }) +] |