Skip to content

Commit 62537d6

Browse files
authored
Merge pull request #34 from Tcode-Motion/test/interpreter-uncaught-throw-14980811631704032051
🧪 Add test for interpreter uncaught throw bubbling
2 parents a3155f2 + 9423679 commit 62537d6

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

runtime/interpreter/tests/interpreter_tests.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,21 @@ try {
194194
assert_eq!(val, RuntimeValue::Str("critical exception".to_string()));
195195
}
196196

197+
#[test]
198+
fn test_interpreter_uncaught_throw() {
199+
let source = r#"
200+
throw "uncaught exception"
201+
"#;
202+
let res = run_source(source);
203+
assert!(res.is_err());
204+
let err = res.unwrap_err();
205+
assert_eq!(err.message, "uncaught exception");
206+
match err.kind {
207+
RuntimeErrorKind::UserError(msg) => assert_eq!(msg, "uncaught exception"),
208+
_ => panic!("Expected UserError"),
209+
}
210+
}
211+
197212
#[test]
198213
fn test_v108_runtime_compatibility() {
199214
let source = r#"

0 commit comments

Comments
 (0)