tangled
alpha
login
or
join now
noahbogart.com
/
sinker
0
fork
atom
catch exceptions hook, line, and sinker
0
fork
atom
overview
issues
pulls
pipelines
add test for usage in macros
noahbogart.com
7 months ago
f02cf824
0a521d35
+13
-1
1 changed file
expand all
collapse all
unified
split
test
noahtheduke
sinker_test.clj
+13
-1
test/noahtheduke/sinker_test.clj
···
73
73
(expect-it "to choose keyword over predicate"
74
74
(= ::pred (first (test-try #(throw (ex-info "" {:key :value
75
75
:var-key :var-value})))))))
76
76
-
(describe "")
77
76
(describe "malformed"
78
77
(expect-it "rejects catches with no body"
79
78
(causes-with-msg?
···
105
104
clojure.lang.Compiler$CompilerException
106
105
#"Syntax error"
107
106
#(eval '(sut/try+ 1 (finally :foo) 2))))))
107
107
+
108
108
+
(defmacro example-macro
109
109
+
[& body]
110
110
+
`(sut/try+ ~@body
111
111
+
(catch ::macro-exception data#
112
112
+
data#)))
113
113
+
114
114
+
(defdescribe macro-test
115
115
+
(it "works with macro-expansion"
116
116
+
(expect (= {:type ::macro-exception
117
117
+
:flavor :grape}
118
118
+
(example-macro (throw (ex-info "gotcha" {:type ::macro-exception
119
119
+
:flavor :grape})))))))