feat(tvix/eval): resolve relative path literals

Resolves relative paths (e.g. `./foo`) either relative to the location
of the Nix file, or relative to the working directory if none is
supplied.

Change-Id: I70ec574657b221b458015117a004b6e4a9c25a30
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6185
Tested-by: BuildkiteCI
Reviewed-by: sterni <sternenseemann@systemli.org>
This commit is contained in:
Vincent Ambo 2022-08-12 18:28:45 +03:00 committed by tazjin
parent 1f8aad0ab4
commit 6fe5e2d752
4 changed files with 37 additions and 10 deletions

View file

@ -11,7 +11,7 @@ fn eval_okay_test(code_path: &str) {
let code = std::fs::read_to_string(code_path).expect("should be able to read test code");
let exp = std::fs::read_to_string(exp_path).expect("should be able to read test expectation");
let result = interpret(&code).expect("evaluation of eval-okay test should succeed");
let result = interpret(&code, None).expect("evaluation of eval-okay test should succeed");
let result_str = format!("{}", result);
assert_eq!(
@ -27,7 +27,7 @@ fn eval_okay_test(code_path: &str) {
fn identity(code_path: &str) {
let code = std::fs::read_to_string(code_path).expect("should be able to read test code");
let result = interpret(&code).expect("evaluation of identity test should succeed");
let result = interpret(&code, None).expect("evaluation of identity test should succeed");
let result_str = format!("{}", result);
assert_eq!(