From 55459f02fcdca8612673f2df8ba54cb995ae06b6 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Fri, 23 Sep 2022 00:47:33 +0300 Subject: test(tvix/eval): add a test for accessing "strange" identifiers Because `inherit` can take string identifiers, we can access arbitrarily weird identifiers in scopes using it. Change-Id: Ic868233221befa160538dd2ffaff1cc7f566585a Reviewed-on: https://cl.tvl.fyi/c/depot/+/6748 Tested-by: BuildkiteCI Reviewed-by: sterni --- .../src/tests/tvix_tests/eval-okay-access-strange-identifier.exp | 1 + .../src/tests/tvix_tests/eval-okay-access-strange-identifier.nix | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-access-strange-identifier.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-access-strange-identifier.nix (limited to 'tvix/eval/src') diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-access-strange-identifier.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-access-strange-identifier.exp new file mode 100644 index 000000000000..d81cc0710eb6 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-access-strange-identifier.exp @@ -0,0 +1 @@ +42 diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-access-strange-identifier.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-access-strange-identifier.nix new file mode 100644 index 000000000000..8e282d1280f1 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-access-strange-identifier.nix @@ -0,0 +1,8 @@ +let + # There is no syntax for accessing this identifier in an ordinary + # way. + "foo bar" = 42; +in ({ + # but we *can* inherit it back out + inherit "foo bar"; +})."foo bar" -- cgit 1.4.1