hyperfiddle / rcf

RCF – a REPL-first, async test macro for Clojure/Script
MIT License
279 stars 12 forks source link

rebuild RCF using clojure/script analyzer (wip) #50

Closed dustingetz closed 2 years ago

dustingetz commented 2 years ago

This is the current WIP dev stream which supports tests like:

(tests 1 := 1)
(tests (let [x 1] x := 1)) — implicit do
(tests (do (do 1 := 1)))
(tests (! 1) % := 1)
(tests (future (! 1)) % := 1)
(tests (do (! 1) % := 1))
(tests (do (future (! 1)) % := 1))
(tests (let [x 1] (! x) := 1)) 
(tests (do (future (! 1)) % := 1))

thereby paving the way for userland syntax macros like (defmacro is [a b] `(do ~a := ~b)), custom assertions, resource cleanup macros, future syntax extensions.

Fixes #46 #44 #42 #40 #34 #32 and is infrastructure for #47 #39 #38 #33

dustingetz commented 2 years ago

Essentially RCF gives meaning to (do a := b) and (do (rcf/! a) rcf/% := b) (which are fully compatible with Clojure) and we use the Clojure/Script analyzer to do this correctly in deeply nested forms including interpreting Clojure special forms that have implicit do.