From 9423679f95fd3ef10c57ebd49e6694d39fcc8d2d Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 25 Aug 2026 09:43:01 +0000 Subject: [PATCH] test: add test case for uncaught throw in interpreter This adds a test case to explicitly verify the error bubbling path for a throw statement that is executed without an enclosing try-catch block in the AST. This satisfies the testing requirement in interpreter_tests.rs for uncaught throws. Co-authored-by: Tcode-Motion <188012755+Tcode-Motion@users.noreply.github.com> --- runtime/interpreter/tests/interpreter_tests.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/runtime/interpreter/tests/interpreter_tests.rs b/runtime/interpreter/tests/interpreter_tests.rs index 65d10824..8b775153 100644 --- a/runtime/interpreter/tests/interpreter_tests.rs +++ b/runtime/interpreter/tests/interpreter_tests.rs @@ -194,6 +194,21 @@ try { assert_eq!(val, RuntimeValue::Str("critical exception".to_string())); } +#[test] +fn test_interpreter_uncaught_throw() { + let source = r#" +throw "uncaught exception" +"#; + let res = run_source(source); + assert!(res.is_err()); + let err = res.unwrap_err(); + assert_eq!(err.message, "uncaught exception"); + match err.kind { + RuntimeErrorKind::UserError(msg) => assert_eq!(msg, "uncaught exception"), + _ => panic!("Expected UserError"), + } +} + #[test] fn test_v108_runtime_compatibility() { let source = r#"