From f1454bbbd13a71da2005ff789cde2da0e9eb81f6 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 22 Jan 2026 15:03:12 +0800 Subject: Adding tests. --- spec/inputs/test/try_catch_spec.yue | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 spec/inputs/test/try_catch_spec.yue (limited to 'spec/inputs/test/try_catch_spec.yue') diff --git a/spec/inputs/test/try_catch_spec.yue b/spec/inputs/test/try_catch_spec.yue new file mode 100644 index 0000000..ed8fef0 --- /dev/null +++ b/spec/inputs/test/try_catch_spec.yue @@ -0,0 +1,12 @@ +describe "try/catch", -> + it "catch and rethrow", -> + ok, success, err = pcall -> + try + error "boom" + catch e + _, result = try + error "wrap:" .. e\match "^.-:%d+:%s*(.*)$" + result + assert.same ok, true + assert.same success, false + assert.is_true err\match("wrap:boom") != nil -- cgit v1.2.3-55-g6feb