From 90fe9a51d7f0837d67d90661c9355f7531621a4d Mon Sep 17 00:00:00 2001 From: sterni Date: Wed, 23 Nov 2022 20:57:08 +0100 Subject: test(tvix/eval): check inner forcing despite declaring pointer Maybe counter-intuitively the inner elements of a list or the attribute values of an attribute set will be forced despite pointer equality (but only one layer deep). Change-Id: I485d96452fb56f5fb342d39039c9137725b33d3f Reviewed-on: https://cl.tvl.fyi/c/depot/+/7371 Reviewed-by: Adam Joseph Tested-by: BuildkiteCI --- .../tvix_tests/eval-fail-force-before-value-pointer-equality.nix | 5 +++++ .../tests/tvix_tests/eval-fail-outer-value-never-pointer-equal.nix | 7 +++++++ 2 files changed, 12 insertions(+) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-fail-force-before-value-pointer-equality.nix create mode 100644 tvix/eval/src/tests/tvix_tests/eval-fail-outer-value-never-pointer-equal.nix (limited to 'tvix/eval') diff --git a/tvix/eval/src/tests/tvix_tests/eval-fail-force-before-value-pointer-equality.nix b/tvix/eval/src/tests/tvix_tests/eval-fail-force-before-value-pointer-equality.nix new file mode 100644 index 000000000000..de6c94325661 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-fail-force-before-value-pointer-equality.nix @@ -0,0 +1,5 @@ +let + x = throw "I have been forced"; +in + +x == x \ No newline at end of file diff --git a/tvix/eval/src/tests/tvix_tests/eval-fail-outer-value-never-pointer-equal.nix b/tvix/eval/src/tests/tvix_tests/eval-fail-outer-value-never-pointer-equal.nix new file mode 100644 index 000000000000..a8c3cedf61d7 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-fail-outer-value-never-pointer-equal.nix @@ -0,0 +1,7 @@ +# For an explanation of this behavior see //tvix/docs/value-pointer-equality.md +let + x = { foo = throw "foo"; }; +in + +# while `builtins.seq x null` would succeed, this fails! +x == x -- cgit 1.4.1