diff options
author | Vincent Ambo <mail@tazj.in> | 2022-12-12T14·38+0300 |
---|---|---|
committer | tazjin <tazjin@tvl.su> | 2022-12-21T22·37+0000 |
commit | c3c4d752c91f64eff8e7f7f7b21fbcc1209d27a6 (patch) | |
tree | 290dba7b8cf36dfbca53a499891dcddaf3cbe735 /tvix/eval/src/tests/mod.rs | |
parent | 25fc6b7c25d75075461e7976b27b81ba6a8140fe (diff) |
feat(tvix/eval): add EvalIO to public crate API r/5459
This lets users set the `io_handle` field on an `Evaluation`, which is then propagated to the VM. Change-Id: I616d7140724fb2b4db47c2ebf95451d5303a487a Reviewed-on: https://cl.tvl.fyi/c/depot/+/7566 Reviewed-by: grfn <grfn@gws.fyi> Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/eval/src/tests/mod.rs')
-rw-r--r-- | tvix/eval/src/tests/mod.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tvix/eval/src/tests/mod.rs b/tvix/eval/src/tests/mod.rs index 65aa12e0a01b..1c872f67d2b0 100644 --- a/tvix/eval/src/tests/mod.rs +++ b/tvix/eval/src/tests/mod.rs @@ -17,7 +17,10 @@ fn eval_test(code_path: &str, expect_success: bool) { return; } - let result = crate::Evaluation::new(&code, Some(code_path.into())).evaluate(); + let mut eval = crate::Evaluation::new(&code, Some(code_path.into())); + eval.io_handle = Box::new(crate::StdIO); + + let result = eval.evaluate(); if expect_success && !result.errors.is_empty() { panic!( @@ -64,7 +67,10 @@ fn eval_test(code_path: &str, expect_success: bool) { fn identity(code_path: &str) { let code = std::fs::read_to_string(code_path).expect("should be able to read test code"); - let result = crate::Evaluation::new(&code, None).evaluate(); + let mut eval = crate::Evaluation::new(&code, None); + eval.io_handle = Box::new(crate::StdIO); + + let result = eval.evaluate(); assert!( result.errors.is_empty(), "evaluation of identity test failed: {:?}", |