snix/tvix/eval/src/tests/tvix_tests
sterni 4d8f35353b fix(tvix/eval): declare let inherit (from) locals before compiling
The recent change that split declaration of let based locals and the
compilation of their values did not touch locals bound by inherit in
let. These were previously declared and compiled immediately before
starting to work on the other locals introduced in a let.

In the case of plain inherits, this behavior is kept in this change,
because there's nothing wrong with it: The value of a plain inherit will
always resolve to a higher scope, either statically or dynamically.

Since inherit (from) expression might refer to other locals bound in the
same let, we need to handle them in the same three steps as ordinary let
based locals:

1. We need to declare the (uninitialised) locals.

2. We need to compile the expression that obtains their value. For this,
   we create a new thunk, since the from expression may very well return
   a thunk which we need to force before selecting the value we are
   interested in.

3. Thunks need to be finalised.

For 1., we create an extra pass over the inherits that already declares
and initialises plain inherits and notes inherit (from) expressions in
the entries vector after declaring them. 2. only needs a bit of adapting
to create the thunks for selecting if appropriate, the rest of the
existing code can be reused.

Change-Id: Ie4ac1c0f9ffcbf7c07c452036aa8e577443af773
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6490
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
Reviewed-by: tazjin <tazjin@tvl.su>
2022-09-11 12:26:23 +00:00
..
eval-okay-arithmetic-float.exp test(tvix/eval): add some eval-okay-* tests for trivial types 2022-08-25 11:07:16 +00:00
eval-okay-arithmetic-float.nix test(tvix/eval): add some eval-okay-* tests for trivial types 2022-08-25 11:07:16 +00:00
eval-okay-arithmetic-int.exp test(tvix/eval): add some eval-okay-* tests for trivial types 2022-08-25 11:07:16 +00:00
eval-okay-arithmetic-int.nix test(tvix/eval): add some eval-okay-* tests for trivial types 2022-08-25 11:07:16 +00:00
eval-okay-attrs-inherit-literal.exp feat(tvix/eval): implement inherit in attribute set literals 2022-08-31 22:10:40 +00:00
eval-okay-attrs-inherit-literal.nix feat(tvix/eval): implement inherit in attribute set literals 2022-08-31 22:10:40 +00:00
eval-okay-attrs-simple-inherit.exp feat(tvix/eval): Implement inherit from outer scope in attrs 2022-08-30 17:13:27 +00:00
eval-okay-attrs-simple-inherit.nix feat(tvix/eval): Implement inherit from outer scope in attrs 2022-08-30 17:13:27 +00:00
eval-okay-attrs-update-empty-lhs.exp feat(tvix/eval): implement attrset update (//) operator 2022-08-25 11:34:00 +00:00
eval-okay-attrs-update-empty-lhs.nix feat(tvix/eval): implement attrset update (//) operator 2022-08-25 11:34:00 +00:00
eval-okay-attrs-update-empty-rhs.exp feat(tvix/eval): implement attrset update (//) operator 2022-08-25 11:34:00 +00:00
eval-okay-attrs-update-empty-rhs.nix feat(tvix/eval): implement attrset update (//) operator 2022-08-25 11:34:00 +00:00
eval-okay-attrs-update-kv-lhs.exp feat(tvix/eval): implement attrset update (//) operator 2022-08-25 11:34:00 +00:00
eval-okay-attrs-update-kv-lhs.nix feat(tvix/eval): implement attrset update (//) operator 2022-08-25 11:34:00 +00:00
eval-okay-attrs-update.exp feat(tvix/eval): implement attrset update (//) operator 2022-08-25 11:34:00 +00:00
eval-okay-attrs-update.nix feat(tvix/eval): implement attrset update (//) operator 2022-08-25 11:34:00 +00:00
eval-okay-builtins-add.exp feat(tvix/eval): Support builtins.{add,sub} 2022-09-07 20:56:02 +00:00
eval-okay-builtins-add.nix feat(tvix/eval): Support builtins.{add,sub} 2022-09-07 20:56:02 +00:00
eval-okay-builtins-div.exp feat(tvix/eval): Support builtins.{mul,div} 2022-09-07 20:56:02 +00:00
eval-okay-builtins-div.nix feat(tvix/eval): Support builtins.{mul,div} 2022-09-07 20:56:02 +00:00
eval-okay-builtins-length.exp feat(tvix/eval): Support builtins.length 2022-09-07 20:56:02 +00:00
eval-okay-builtins-length.nix feat(tvix/eval): Support builtins.length 2022-09-07 20:56:02 +00:00
eval-okay-builtins-mul.exp feat(tvix/eval): Support builtins.{mul,div} 2022-09-07 20:56:02 +00:00
eval-okay-builtins-mul.nix feat(tvix/eval): Support builtins.{mul,div} 2022-09-07 20:56:02 +00:00
eval-okay-builtins-sub.exp feat(tvix/eval): Support builtins.{add,sub} 2022-09-07 20:56:02 +00:00
eval-okay-builtins-sub.nix feat(tvix/eval): Support builtins.{add,sub} 2022-09-07 20:56:02 +00:00
eval-okay-builtins-toString.exp test(tvix/eval): add a simple test for builtins resolution 2022-09-02 12:59:23 +00:00
eval-okay-builtins-toString.nix test(tvix/eval): add a simple test for builtins resolution 2022-09-02 12:59:23 +00:00
eval-okay-closure-self.exp feat(tvix/eval): implement capture of self-recursive upvalues 2022-09-06 07:29:25 +00:00
eval-okay-closure-self.nix feat(tvix/eval): implement capture of self-recursive upvalues 2022-09-06 07:29:25 +00:00
eval-okay-closure-with-shadowing.exp fix(tvix/eval): correctly resolve dynamic upvalues one scope up 2022-09-06 07:29:25 +00:00
eval-okay-closure-with-shadowing.nix fix(tvix/eval): correctly resolve dynamic upvalues one scope up 2022-09-06 07:29:25 +00:00
eval-okay-cmp-float-false.exp feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-float-false.nix feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-float-true.exp feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-float-true.nix feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-int-false.exp feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-int-false.nix feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-int-true.exp feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-int-true.nix feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-num-false.exp feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-num-false.nix feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-num-true.exp feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-num-true.nix feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-str-false.exp feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-str-false.nix feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-str-true.exp feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-cmp-str-true.nix feat(tvix/eval): implement binary comparison operators 2022-08-25 12:07:30 +00:00
eval-okay-concat-lists.exp feat(tvix/eval): implement list concatenation 2022-08-25 12:07:30 +00:00
eval-okay-concat-lists.nix feat(tvix/eval): implement list concatenation 2022-08-25 12:07:30 +00:00
eval-okay-concat-strings.exp feat(tvix/eval): implement string concatenation 2022-08-25 11:11:27 +00:00
eval-okay-concat-strings.nix feat(tvix/eval): implement string concatenation 2022-08-25 11:11:27 +00:00
eval-okay-contains-nested-non-set.exp fix(tvix/eval): ? operator should use OpAttrsOrNotFound 2022-08-30 17:13:27 +00:00
eval-okay-contains-nested-non-set.nix fix(tvix/eval): ? operator should use OpAttrsOrNotFound 2022-08-30 17:13:27 +00:00
eval-okay-contains-non-set.exp fix(tvix/eval): allow use of ? operator on non-set types 2022-08-30 17:13:27 +00:00
eval-okay-contains-non-set.nix fix(tvix/eval): allow use of ? operator on non-set types 2022-08-30 17:13:27 +00:00
eval-okay-deeply-nested-attrs.exp fix(tvix/eval): emit correct count in OpAttrPath 2022-08-30 17:13:27 +00:00
eval-okay-deeply-nested-attrs.nix fix(tvix/eval): emit correct count in OpAttrPath 2022-08-30 17:13:27 +00:00
eval-okay-deeply-nested-with-closure.exp fix(tvix/eval): correctly thread through dynamic upvalues 2022-09-06 07:45:43 +00:00
eval-okay-deeply-nested-with-closure.nix fix(tvix/eval): correctly thread through dynamic upvalues 2022-09-06 07:45:43 +00:00
eval-okay-deeply-nested-with.exp fix(tvix/eval): correctly resolve dynamic upvalues one scope up 2022-09-06 07:29:25 +00:00
eval-okay-deeply-nested-with.nix fix(tvix/eval): correctly resolve dynamic upvalues one scope up 2022-09-06 07:29:25 +00:00
eval-okay-deferred-with.exp fix(tvix/eval): thunk all uses of with 2022-09-11 12:26:23 +00:00
eval-okay-deferred-with.nix fix(tvix/eval): thunk all uses of with 2022-09-11 12:26:23 +00:00
eval-okay-eq-float.exp feat(tvix): implement not-equals (!=) operator 2022-08-25 11:34:00 +00:00
eval-okay-eq-float.nix feat(tvix): implement not-equals (!=) operator 2022-08-25 11:34:00 +00:00
eval-okay-eq-int.exp feat(tvix): implement not-equals (!=) operator 2022-08-25 11:34:00 +00:00
eval-okay-eq-int.nix feat(tvix): implement not-equals (!=) operator 2022-08-25 11:34:00 +00:00
eval-okay-fib.exp fix(tvix/eval): instantiate *new* closures from blueprints each time 2022-09-06 07:45:43 +00:00
eval-okay-fib.nix fix(tvix/eval): instantiate *new* closures from blueprints each time 2022-09-06 07:45:43 +00:00
eval-okay-fix.exp feat(tvix/eval): thunk binary operations and select expressions 2022-09-08 20:17:26 +00:00
eval-okay-fix.nix feat(tvix/eval): thunk binary operations and select expressions 2022-09-08 20:17:26 +00:00
eval-okay-float-repr.exp test(tvix/eval): add a test for float representation 2022-09-03 00:49:45 +00:00
eval-okay-float-repr.nix test(tvix/eval): add a test for float representation 2022-09-03 00:49:45 +00:00
eval-okay-lambda-identity.exp feat(tvix/eval): compile function applications 2022-09-02 12:31:04 +00:00
eval-okay-lambda-identity.nix feat(tvix/eval): compile function applications 2022-09-02 12:31:04 +00:00
eval-okay-late-binding-closure.exp feat(tvix/eval): emit OpFinalise when local scopes are complete 2022-09-06 14:58:52 +00:00
eval-okay-late-binding-closure.nix feat(tvix/eval): emit OpFinalise when local scopes are complete 2022-09-06 14:58:52 +00:00
eval-okay-late-binding.exp test(tvix/eval): test very simple late-bound identifier access 2022-09-07 15:25:59 +00:00
eval-okay-late-binding.nix test(tvix/eval): test very simple late-bound identifier access 2022-09-07 15:25:59 +00:00
eval-okay-let-identifiers.exp test(tvix/eval): add basic tests for let expressions 2022-08-29 20:13:26 +00:00
eval-okay-let-identifiers.nix test(tvix/eval): add basic tests for let expressions 2022-08-29 20:13:26 +00:00
eval-okay-let-inherit-from-later-bound.exp fix(tvix/eval): declare let inherit (from) locals before compiling 2022-09-11 12:26:23 +00:00
eval-okay-let-inherit-from-later-bound.nix fix(tvix/eval): declare let inherit (from) locals before compiling 2022-09-11 12:26:23 +00:00
eval-okay-let-inherit.exp fix(tvix/eval): declare let inherit (from) locals before compiling 2022-09-11 12:26:23 +00:00
eval-okay-let-inherit.nix fix(tvix/eval): declare let inherit (from) locals before compiling 2022-09-11 12:26:23 +00:00
eval-okay-let-sibling-access.exp test(tvix/eval): add basic tests for let expressions 2022-08-29 20:13:26 +00:00
eval-okay-let-sibling-access.nix test(tvix/eval): add basic tests for let expressions 2022-08-29 20:13:26 +00:00
eval-okay-manual-rec.exp fix(tvix/eval): thunk all uses of with 2022-09-11 12:26:23 +00:00
eval-okay-manual-rec.nix fix(tvix/eval): thunk all uses of with 2022-09-11 12:26:23 +00:00
eval-okay-multiline-string.exp test(tvix/eval): add some eval-okay-* tests for trivial types 2022-08-25 11:07:16 +00:00
eval-okay-multiline-string.nix test(tvix/eval): add some eval-okay-* tests for trivial types 2022-08-25 11:07:16 +00:00
eval-okay-multiple-nested-attrs.exp test(tvix/eval): add some eval-okay-* tests for trivial types 2022-08-25 11:07:16 +00:00
eval-okay-multiple-nested-attrs.nix test(tvix/eval): add some eval-okay-* tests for trivial types 2022-08-25 11:07:16 +00:00
eval-okay-ne-int.exp feat(tvix): implement not-equals (!=) operator 2022-08-25 11:34:00 +00:00
eval-okay-ne-int.nix feat(tvix): implement not-equals (!=) operator 2022-08-25 11:34:00 +00:00
eval-okay-ne-string.exp feat(tvix): implement not-equals (!=) operator 2022-08-25 11:34:00 +00:00
eval-okay-ne-string.nix feat(tvix): implement not-equals (!=) operator 2022-08-25 11:34:00 +00:00
eval-okay-nested-closure.exp test(tvix/eval): add tests for very simple closures 2022-09-04 17:40:10 +00:00
eval-okay-nested-closure.nix test(tvix/eval): add tests for very simple closures 2022-09-04 17:40:10 +00:00
eval-okay-nested-deferred-upvalue.exp test(tvix/eval): add a test case for nested, deferred upvalues 2022-09-06 14:58:52 +00:00
eval-okay-nested-deferred-upvalue.nix test(tvix/eval): add a test case for nested, deferred upvalues 2022-09-06 14:58:52 +00:00
eval-okay-nested-let-slots.exp test(tvix/eval): add test for stack slot accounting edge-case 2022-09-08 20:17:26 +00:00
eval-okay-nested-let-slots.nix test(tvix/eval): add test for stack slot accounting edge-case 2022-09-08 20:17:26 +00:00
eval-okay-nested-let.exp refactor(tvix/eval): simplify let ... in ... before recursion 2022-08-31 22:42:48 +00:00
eval-okay-nested-let.nix refactor(tvix/eval): simplify let ... in ... before recursion 2022-08-31 22:42:48 +00:00
eval-okay-nested-poisoning.exp fix(tvix/eval): inherit scope poisoning data in nested contexts 2022-09-08 07:59:15 +00:00
eval-okay-nested-poisoning.nix fix(tvix/eval): inherit scope poisoning data in nested contexts 2022-09-08 07:59:15 +00:00
eval-okay-nested-thunks.exp feat(tvix/eval): always emit OpForce as the last instruction 2022-09-07 15:25:59 +00:00
eval-okay-nested-thunks.nix feat(tvix/eval): always emit OpForce as the last instruction 2022-09-07 15:25:59 +00:00
eval-okay-nested-with.exp test(tvix/eval): add basic tests for with expressions 2022-08-31 22:42:48 +00:00
eval-okay-nested-with.nix test(tvix/eval): add basic tests for with expressions 2022-08-31 22:42:48 +00:00
eval-okay-or-operator-default.exp test(tvix/eval): add tests for the attrset or operator 2022-08-26 16:05:09 +00:00
eval-okay-or-operator-default.nix test(tvix/eval): add tests for the attrset or operator 2022-08-26 16:05:09 +00:00
eval-okay-or-operator-nested-default.exp test(tvix/eval): add tests for the attrset or operator 2022-08-26 16:05:09 +00:00
eval-okay-or-operator-nested-default.nix test(tvix/eval): add tests for the attrset or operator 2022-08-26 16:05:09 +00:00
eval-okay-or-operator-nested.exp test(tvix/eval): add tests for the attrset or operator 2022-08-26 16:05:09 +00:00
eval-okay-or-operator-nested.nix test(tvix/eval): add tests for the attrset or operator 2022-08-26 16:05:09 +00:00
eval-okay-or-operator-non-set.exp fix(tvix/eval): or should handle non-attrset values, too 2022-08-30 17:13:27 +00:00
eval-okay-or-operator-non-set.nix fix(tvix/eval): or should handle non-attrset values, too 2022-08-30 17:13:27 +00:00
eval-okay-or-operator.exp test(tvix/eval): add tests for the attrset or operator 2022-08-26 16:05:09 +00:00
eval-okay-or-operator.nix test(tvix/eval): add tests for the attrset or operator 2022-08-26 16:05:09 +00:00
eval-okay-overlapping-nested-attrs.exp test(tvix/eval): add some eval-okay-* tests for trivial types 2022-08-25 11:07:16 +00:00
eval-okay-overlapping-nested-attrs.nix test(tvix/eval): add some eval-okay-* tests for trivial types 2022-08-25 11:07:16 +00:00
eval-okay-poisoned-scopes.exp feat(tvix/eval): implement scope poisoning for true/false/null 2022-08-31 22:42:48 +00:00
eval-okay-poisoned-scopes.nix feat(tvix/eval): implement scope poisoning for true/false/null 2022-08-31 22:42:48 +00:00
eval-okay-simple-closure.exp test(tvix/eval): add tests for very simple closures 2022-09-04 17:40:10 +00:00
eval-okay-simple-closure.nix test(tvix/eval): add tests for very simple closures 2022-09-04 17:40:10 +00:00
eval-okay-simple-interpol.exp feat(tvix/eval): implement string concatenation 2022-08-25 11:11:27 +00:00
eval-okay-simple-interpol.nix feat(tvix/eval): implement string concatenation 2022-08-25 11:11:27 +00:00
eval-okay-simple-let.exp test(tvix/eval): add basic tests for let expressions 2022-08-29 20:13:26 +00:00
eval-okay-simple-let.nix test(tvix/eval): add basic tests for let expressions 2022-08-29 20:13:26 +00:00
eval-okay-simple-nested-attrs.exp test(tvix/eval): add some eval-okay-* tests for trivial types 2022-08-25 11:07:16 +00:00
eval-okay-simple-nested-attrs.nix test(tvix/eval): add some eval-okay-* tests for trivial types 2022-08-25 11:07:16 +00:00
eval-okay-simple-with.exp test(tvix/eval): add basic tests for with expressions 2022-08-31 22:42:48 +00:00
eval-okay-simple-with.nix test(tvix/eval): add basic tests for with expressions 2022-08-31 22:42:48 +00:00
eval-okay-thunked-with.exp fix(tvix/eval): account for attrset temporaries during construction 2022-09-11 12:04:27 +00:00
eval-okay-thunked-with.nix fix(tvix/eval): account for attrset temporaries during construction 2022-09-11 12:04:27 +00:00
eval-okay-toplevel-finaliser.exp fix(tvix/eval): consider local depth when deciding to defer 2022-09-08 20:17:26 +00:00
eval-okay-toplevel-finaliser.nix fix(tvix/eval): consider local depth when deciding to defer 2022-09-08 20:17:26 +00:00
eval-okay-unpoison-scope.exp feat(tvix/eval): implement scope poisoning for true/false/null 2022-08-31 22:42:48 +00:00
eval-okay-unpoison-scope.nix feat(tvix/eval): implement scope poisoning for true/false/null 2022-08-31 22:42:48 +00:00
eval-okay-useless-inherit-with.exp fix(tvix/eval): consider let ... inherit ... in dynamic scopes 2022-09-02 14:13:00 +00:00
eval-okay-useless-inherit-with.nix fix(tvix/eval): consider let ... inherit ... in dynamic scopes 2022-09-02 14:13:00 +00:00
eval-okay-with-closure.exp feat(tvix/eval): implement upvalue resolution in with scopes 2022-09-04 17:40:10 +00:00
eval-okay-with-closure.nix feat(tvix/eval): implement upvalue resolution in with scopes 2022-09-04 17:40:10 +00:00
eval-okay-with-in-dynamic-key.exp fix(tvix/eval): account for attrset temporaries during construction 2022-09-11 12:04:27 +00:00
eval-okay-with-in-dynamic-key.nix fix(tvix/eval): account for attrset temporaries during construction 2022-09-11 12:04:27 +00:00
eval-okay-with-in-list.exp fix(tvix/eval): correctly account for slots during list construction 2022-09-11 12:16:46 +00:00
eval-okay-with-in-list.nix fix(tvix/eval): correctly account for slots during list construction 2022-09-11 12:16:46 +00:00
identity-bool-false.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-bool-true.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-dollar-escape.nix fix(tvix/eval): correctly escape ${ in strings 2022-09-03 00:47:58 +00:00
identity-empty-attrs.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-empty-list.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-flat-attrs.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-float.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-heterogeneous-list.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-homogeneous-float-list.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-homogeneous-int-list.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-homogeneous-string-list.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-int.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-kv-attrs.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-nested-attrs.nix feat(tvix/eval): semi-strictly evaluate output values of the VM 2022-09-07 19:08:56 +00:00
identity-null.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-signed-float.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-signed-int.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
identity-string.nix test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00
README.md test(tvix/eval): add identity tests for literal evaluation 2022-08-24 23:11:12 +00:00

These tests are "native" to Tvix and exist in addition to the Nix test suite.

All of these are straightforward code snippets which are expected to produce a certain result.

identity-* tests

Files named identity-*.nix contain code that is supposed to produce itself exactly after evaluation.

These are useful for testing literals.

eval-okay-* tests

Files named eval-okay-*.nix contain code which is supposed to evaluate to the output in the corresponding eval-okay-*.exp file.

This convention is taken from the original Nix test suite.