From 0974fe0b089d1efec06bd0e9487151e7b8daa443 Mon Sep 17 00:00:00 2001 From: Juan Monetta Date: Wed, 31 Jan 2024 10:38:57 -0300 Subject: [PATCH] Add uncached-throw-inner test --- src/test/cljs/cljs/storm/bodies_test.cljs | 13 +++++++++++++ src/test/cljs/cljs/storm/tests_code/bodies.cljs | 5 +++++ 2 files changed, 18 insertions(+) diff --git a/src/test/cljs/cljs/storm/bodies_test.cljs b/src/test/cljs/cljs/storm/bodies_test.cljs index 2e1ad6e3c..ad9bbcd18 100644 --- a/src/test/cljs/cljs/storm/bodies_test.cljs +++ b/src/test/cljs/cljs/storm/bodies_test.cljs @@ -23,6 +23,19 @@ (is (= [[:fn-call "cljs.storm.tests-code.bodies" "uncached-throw" [] 970185633] [:expr-exec "#object[...]" "3,1"] [:fn-unwind "Dang" ""]] + (u/capture)) "captured traces should match."))) + +(deftest uncached-throw-inner-test + (let [r (try + (b/uncached-throw-inner) + (catch js/Error e :throwed))] + (is (= :throwed r) "function should have throwed") + (is (= [[:fn-call "cljs.storm.tests-code.bodies" "uncached-throw-inner" [] -599626572] + [:bind "f" "#object[...]" "3"] + [:fn-call "cljs.storm.tests-code.bodies" "inner" [] -599626572] + [:expr-exec "#object[...]" "3,1,1,3,1"] + [:fn-unwind "Dang" "3,1,1"] + [:fn-unwind "Dang" ""]] (u/capture)) "captured traces should match."))) (deftest letfn-test diff --git a/src/test/cljs/cljs/storm/tests_code/bodies.cljs b/src/test/cljs/cljs/storm/tests_code/bodies.cljs index 401b61568..255b147e7 100644 --- a/src/test/cljs/cljs/storm/tests_code/bodies.cljs +++ b/src/test/cljs/cljs/storm/tests_code/bodies.cljs @@ -10,6 +10,11 @@ (defn uncached-throw [] (throw (js/Error. "Dang"))) +(defn uncached-throw-inner [] + (let [f (fn inner [] + (throw (js/Error. "Dang")))] + (f))) + (defn letfn-fn [] (letfn [(square [x] (* x x))]