diff options
Diffstat (limited to 'tvix/eval/src/tests/mod.rs')
-rw-r--r-- | tvix/eval/src/tests/mod.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tvix/eval/src/tests/mod.rs b/tvix/eval/src/tests/mod.rs index 02227a7e9a2d..b7bea6094d44 100644 --- a/tvix/eval/src/tests/mod.rs +++ b/tvix/eval/src/tests/mod.rs @@ -1,3 +1,4 @@ +use crate::value::Value; use builtin_macros::builtins; use pretty_assertions::assert_eq; use test_generator::test_resources; @@ -57,19 +58,23 @@ fn eval_test(code_path: &str, expect_success: bool) { eval.builtins.extend(mock_builtins::builtins()); let result = eval.evaluate(); - - if expect_success && !result.errors.is_empty() { + let failed = match result.value { + Some(Value::Catchable(_)) => true, + _ => !result.errors.is_empty(), + }; + if expect_success && failed { panic!( "{code_path}: evaluation of eval-okay test should succeed, but failed with {:?}", result.errors, ); } - if !expect_success && !result.errors.is_empty() { + if !expect_success && failed { return; } - let result_str = result.value.unwrap().to_string(); + let value = result.value.unwrap(); + let result_str = value.to_string(); if let Ok(exp) = std::fs::read_to_string(exp_path) { if expect_success { |