From 0e9f5d6890df5820be836cff78622d3f1dcfe155 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sun, 9 Oct 2022 21:59:41 -0400 Subject: feat(tvix/eval): Allow adding strings to paths Implement adding paths and strings via OpAdd. Since the nix rules are quite obscure, I'm electing to test this one with an oracle test to avoid the danger of getting the actual asserted result wrong. Change-Id: Icdcca3690ca2e8459e386c1f29cc48eaaa39e9a3 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6914 Autosubmit: grfn Reviewed-by: tazjin Tested-by: BuildkiteCI --- tvix/eval/tests/nix_oracle.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'tvix/eval/tests') diff --git a/tvix/eval/tests/nix_oracle.rs b/tvix/eval/tests/nix_oracle.rs index 61f2be674e..34ed503510 100644 --- a/tvix/eval/tests/nix_oracle.rs +++ b/tvix/eval/tests/nix_oracle.rs @@ -15,7 +15,7 @@ fn nix_eval(expr: &str) -> String { let store_dir = TempDir::new("store-dir").unwrap(); let output = Command::new(nix_binary_path()) - .args(["--eval", "-E"]) + .args(["--eval", "--strict", "-E"]) .arg(format!("({expr})")) .env( "NIX_REMOTE", @@ -66,4 +66,13 @@ compare_eval_tests! { literal_int("1"); add_ints("1 + 1"); add_lists("[1 2] ++ [3 4]"); + add_paths(r#"[ + (./. + "/") + (./foo + "bar") + (let name = "bar"; in ./foo + name) + (let name = "bar"; in ./foo + "${name}") + (let name = "bar"; in ./foo + "/" + "${name}") + (let name = "bar"; in ./foo + "/${name}") + (./. + ./.) + ]"#); } -- cgit 1.4.1