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:
parent
278bccc1ea
commit
b4d978cd6a
5 changed files with 11 additions and 2 deletions
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
1
tvix/eval/src/tests/tvix_tests/directory/default.nix
Normal file
1
tvix/eval/src/tests/tvix_tests/directory/default.nix
Normal file
|
|
@ -0,0 +1 @@
|
|||
42
|
||||
1
tvix/eval/src/tests/tvix_tests/eval-okay-import.exp
Normal file
1
tvix/eval/src/tests/tvix_tests/eval-okay-import.exp
Normal file
|
|
@ -0,0 +1 @@
|
|||
[ 42 42 ]
|
||||
4
tvix/eval/src/tests/tvix_tests/eval-okay-import.nix
Normal file
4
tvix/eval/src/tests/tvix_tests/eval-okay-import.nix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
(import ./directory)
|
||||
(import ./directory/default.nix)
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue