From 7702941dd9f561cb1f90ada28aa7401ea54a86db Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 29 Jan 2023 18:49:06 +0300 Subject: test(tvix/eval): add tests for internal formals dependencies Formals can depend on each other when using another formal as a default value. This test ensures that the compiler's declaration and initialisation order of formals is consistent with what actually happens in the VM. Change-Id: Ibdabe262554e8066d67fac1ebc3b5a48ef626e18 Reviewed-on: https://cl.tvl.fyi/c/depot/+/7948 Reviewed-by: sterni Tested-by: BuildkiteCI Reviewed-by: flokli --- tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals-deferred.exp | 1 + tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals-deferred.nix | 3 +++ tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals.exp | 1 + tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals.nix | 3 +++ 4 files changed, 8 insertions(+) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals-deferred.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals-deferred.nix create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals.nix (limited to 'tvix') diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals-deferred.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals-deferred.exp new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals-deferred.exp @@ -0,0 +1 @@ +42 diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals-deferred.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals-deferred.nix new file mode 100644 index 0000000000..5c6702120f --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals-deferred.nix @@ -0,0 +1,3 @@ +# Tests formals which have internal default values that must be deferred. + +({ optional ? defaultValue, defaultValue }: optional) { defaultValue = 42; } diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals.exp new file mode 100644 index 0000000000..d81cc0710e --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals.exp @@ -0,0 +1 @@ +42 diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals.nix new file mode 100644 index 0000000000..c6dd5e9d54 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-internal-formals.nix @@ -0,0 +1,3 @@ +# Tests formals which have internal default values. + +({ defaultValue, optional ? defaultValue }: optional) { defaultValue = 42; } -- cgit 1.4.1