From 36748fe4f65d85049c5aec2df4828668803ad30b Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 13 Aug 2022 20:20:34 +0300 Subject: [PATCH] test(tvix/eval): add basic tests for let expressions Change-Id: I788504f0c1848a1422c99006bf659738df614716 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6191 Tested-by: BuildkiteCI Reviewed-by: grfn --- tvix/eval/src/tests/tvix_tests/eval-okay-let-identifiers.exp | 1 + tvix/eval/src/tests/tvix_tests/eval-okay-let-identifiers.nix | 5 +++++ .../src/tests/tvix_tests/eval-okay-let-sibling-access.exp | 1 + .../src/tests/tvix_tests/eval-okay-let-sibling-access.nix | 5 +++++ tvix/eval/src/tests/tvix_tests/eval-okay-simple-let.exp | 1 + tvix/eval/src/tests/tvix_tests/eval-okay-simple-let.nix | 4 ++++ 6 files changed, 17 insertions(+) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-let-identifiers.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-let-identifiers.nix create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-let-sibling-access.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-let-sibling-access.nix create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-simple-let.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-simple-let.nix diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-let-identifiers.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-let-identifiers.exp new file mode 100644 index 000000000..5776134d0 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-let-identifiers.exp @@ -0,0 +1 @@ +[ 1 2 3 ] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-let-identifiers.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-let-identifiers.nix new file mode 100644 index 000000000..b6c37c34f --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-let-identifiers.nix @@ -0,0 +1,5 @@ +let + a = 1; + "b" = 2; + ${"c"} = 3; +in [ a b c ] diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-let-sibling-access.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-let-sibling-access.exp new file mode 100644 index 000000000..00750edc0 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-let-sibling-access.exp @@ -0,0 +1 @@ +3 diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-let-sibling-access.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-let-sibling-access.nix new file mode 100644 index 000000000..7a65a5b1c --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-let-sibling-access.nix @@ -0,0 +1,5 @@ +let + a = 1; + b = 2; + c = a + b; +in c diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-simple-let.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-simple-let.exp new file mode 100644 index 000000000..00750edc0 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-simple-let.exp @@ -0,0 +1 @@ +3 diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-simple-let.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-simple-let.nix new file mode 100644 index 000000000..b440a220f --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-simple-let.nix @@ -0,0 +1,4 @@ +let + a = 1; + b = 2; +in a + b