feat(tvix/tests): Import default.nix inside directory

This requires actually passing the source directory into `interpret` in
the eval tests, but otherwise this is fairly straightforward - if we're
trying to import a directory, just push `default.nix` onto it and import
that instead.

Change-Id: I0b7d4234f81977e78d14dfa651bf0cf9721017e5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6893
Autosubmit: grfn <grfn@gws.fyi>
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
Griffin Smith 2022-10-08 13:48:08 -04:00 committed by grfn
parent 278bccc1ea
commit b4d978cd6a
5 changed files with 11 additions and 2 deletions

View file

@ -12,7 +12,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, None, Default::default())
let result = interpret(&code, Some(code_path.into()), Default::default())
.expect("evaluation of eval-okay test should succeed");
let result_str = format!("{}", result);

View file

@ -0,0 +1 @@
42

View file

@ -0,0 +1 @@
[ 42 42 ]

View file

@ -0,0 +1,4 @@
[
(import ./directory)
(import ./directory/default.nix)
]