rcf
rcf copied to clipboard
Babashka / sci support
Hi,
Your project looks nice and while I do have some inheritted resistance to putting tests in the same file as code I also see the benefits.
I am writing libraries and pieces of code that also target babashka - since I use some of them for scripting.
I would like to know if this works with sci/babashka . If I use this in libraries - would they work with babashka ?
If you have not considered babashka before, this issue is just for that :).
Thanks,
RCF doesn't force you to put tests in the same file as your source, you can put them anywhere you think they belong.
We didn't considered Babashka yet. Contributions are welcome 👍
Thank you for creating this issue, we will use it to track Babashka compatibility.
It seems to work:
(require '[babashka.deps :as deps])
(deps/add-deps '{:deps {com.hyperfiddle/rcf {:mvn/version "20220405"}
org.babashka/spec.alpha {:git/url "https://github.com/babashka/spec.alpha"
:git/sha "1a841c4cc1d4f6dab7505a98ed2d532dd9d56b78"}}})
(require '[hyperfiddle.rcf :as rcf :refer [tests ! %]])
(rcf/enable!)
(tests
"equality"
(inc 1) := 3
"wildcards"
{:a :b, :b [2 :b]} := {:a _, _ [2 _]}
)
https://twitter.com/borkdude/status/1511829490732777477
While the versions linked by @borkdude work, it doesn't work with master, analyzer.clj throws an error
: Could not resolve symbol: clojure.core/in-ns user
Interesting behavior from bb repl
user> `in-ns
;; => clojure.core/in-ns
user> #'clojure.core/in-ns
: Could not resolve symbol: clojure.core/in-ns user
user> clojure.core/in-ns
: Could not resolve symbol: clojure.core/in-ns user *cider-repl git/fluent-platform:localhost:1667(clj)*:1:1
Of course there might be more gotchas along the way.
@xificurC When I posted the last comment it still worked. You may want to bisect from there to see what caused it. I think currently in-ns
is treated more as a special form than a macro/var in SCI.
@borkdude maybe this should be fixed in sci then? in-ns
is just a function
https://github.com/clojure/clojure/blob/c01f10bd8c68bd16c657fe352b206573f9306168/src/jvm/clojure/lang/RT.java#L240
Made an issue here now: https://github.com/babashka/sci/issues/790.
Hmm yes. Can you post a SCI issue? Currently afk.
On Fri, 19 Aug 2022 at 13:21, Peter Nagy @.***> wrote:
@borkdude https://github.com/borkdude maybe this should be fixed in sci then? in-ns is just a function
https://github.com/clojure/clojure/blob/c01f10bd8c68bd16c657fe352b206573f9306168/src/jvm/clojure/lang/RT.java#L240
— Reply to this email directly, view it on GitHub https://github.com/hyperfiddle/rcf/issues/35#issuecomment-1220556682, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFSBU7MWRUPCWUDODZFHTVZ5U4TANCNFSM5HDSPYVQ . You are receiving this because you were mentioned.Message ID: @.***>
-- https://www.michielborkent.nl https://www.eetvoorjeleven.nu