From e1e8285ecfe94fc9afd33110ff63ce707fa4369a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 20 Nov 2022 23:12:00 +0100 Subject: test(tvix/eval): enable eval-okay-closure test from nix_tests This function covers builtins.genericClosure, seemingly including weird behaviour around the order in which the work set is processed. For some reason, in C++ Nix the test expectation is written in XML which we do not yet support, so I have created a new expectation file using `nix-instantiate --eval --strict` on the file (yes, using C++ Nix). Change-Id: Id90e7117d120dc66d963a51083c4d8e8f2d9f181 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7311 Reviewed-by: sterni Tested-by: BuildkiteCI --- tvix/eval/src/tests/nix_tests/eval-okay-closure.exp | 1 + tvix/eval/src/tests/nix_tests/eval-okay-closure.nix | 13 +++++++++++++ .../src/tests/nix_tests/notyetpassing/eval-okay-closure.nix | 13 ------------- 3 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 tvix/eval/src/tests/nix_tests/eval-okay-closure.exp create mode 100644 tvix/eval/src/tests/nix_tests/eval-okay-closure.nix delete mode 100644 tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-closure.nix (limited to 'tvix/eval') diff --git a/tvix/eval/src/tests/nix_tests/eval-okay-closure.exp b/tvix/eval/src/tests/nix_tests/eval-okay-closure.exp new file mode 100644 index 000000000000..e7dbf978160d --- /dev/null +++ b/tvix/eval/src/tests/nix_tests/eval-okay-closure.exp @@ -0,0 +1 @@ +[ { foo = true; key = -13; } { foo = true; key = -12; } { foo = true; key = -11; } { foo = true; key = -9; } { foo = true; key = -8; } { foo = true; key = -7; } { foo = true; key = -5; } { foo = true; key = -4; } { foo = true; key = -3; } { key = -1; } { foo = true; key = 0; } { foo = true; key = 1; } { foo = true; key = 2; } { foo = true; key = 4; } { foo = true; key = 5; } { foo = true; key = 6; } { key = 8; } { foo = true; key = 9; } { foo = true; key = 10; } { foo = true; key = 13; } { foo = true; key = 14; } { foo = true; key = 15; } { key = 17; } { foo = true; key = 18; } { foo = true; key = 19; } { foo = true; key = 22; } { foo = true; key = 23; } { key = 26; } { foo = true; key = 27; } { foo = true; key = 28; } { foo = true; key = 31; } { foo = true; key = 32; } { key = 35; } { foo = true; key = 36; } { foo = true; key = 40; } { foo = true; key = 41; } { key = 44; } { foo = true; key = 45; } { foo = true; key = 49; } { key = 53; } { foo = true; key = 54; } { foo = true; key = 58; } { key = 62; } { foo = true; key = 67; } { key = 71; } { key = 80; } ] diff --git a/tvix/eval/src/tests/nix_tests/eval-okay-closure.nix b/tvix/eval/src/tests/nix_tests/eval-okay-closure.nix new file mode 100644 index 000000000000..cccd4dc35730 --- /dev/null +++ b/tvix/eval/src/tests/nix_tests/eval-okay-closure.nix @@ -0,0 +1,13 @@ +let + + closure = builtins.genericClosure { + startSet = [{key = 80;}]; + operator = {key, foo ? false}: + if builtins.lessThan key 0 + then [] + else [{key = builtins.sub key 9;} {key = builtins.sub key 13; foo = true;}]; + }; + + sort = (import ./lib.nix).sortBy (a: b: builtins.lessThan a.key b.key); + +in sort closure diff --git a/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-closure.nix b/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-closure.nix deleted file mode 100644 index ab4aa0e49eb6..000000000000 --- a/tvix/eval/src/tests/nix_tests/notyetpassing/eval-okay-closure.nix +++ /dev/null @@ -1,13 +0,0 @@ -let - - closure = builtins.genericClosure { - startSet = [{key = 80;}]; - operator = {key, foo ? false}: - if builtins.lessThan key 0 - then [] - else [{key = builtins.sub key 9;} {key = builtins.sub key 13; foo = true;}]; - }; - - sort = (import ./../lib.nix).sortBy (a: b: builtins.lessThan a.key b.key); - -in sort closure -- cgit 1.4.1