Created
August 18, 2025 20:21
-
-
Save camsaul/2210ba7807d82cadbff625a70e4e3ee2 to your computer and use it in GitHub Desktop.
Split tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn split-tests [[_deftest test-name & args]] | |
(into [] | |
(comp (mapcat (fn split* [expr] | |
(case (first expr) | |
is (let [[_is assert-expr message] expr] | |
[(if message | |
(list 'testing message | |
(list 'is assert-expr)) | |
(list 'is assert-expr))]) | |
testing (let [[_testing message & exprs] expr] | |
(for [expr (mapcat split* exprs)] | |
(list 'testing message expr))) | |
#_else | |
[expr]))) | |
(map-indexed (fn [i expr] | |
(list (symbol "deftest ^:parallel") | |
(symbol (str test-name "-" (inc i))) | |
expr)))) | |
args)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment