Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Babashka / sci support #35

Open
ieugen opened this issue Nov 1, 2021 · 7 comments
Open

Babashka / sci support #35

ieugen opened this issue Nov 1, 2021 · 7 comments
Labels
bb Babashka enhancement New feature or request good first issue Good for newcomers

Comments

@ieugen
Copy link
Contributor

ieugen commented Nov 1, 2021

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,

@ggeoffrey
Copy link
Member

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.

@ggeoffrey ggeoffrey added enhancement New feature or request good first issue Good for newcomers bb Babashka labels Nov 2, 2021
@borkdude
Copy link
Contributor

borkdude commented Apr 7, 2022

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

@dustingetz dustingetz changed the title Babashka support - does it work with babashka / sci ? Babashka / sci support Apr 9, 2022
@xificurC
Copy link
Contributor

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.

@borkdude
Copy link
Contributor

@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.

@xificurC
Copy link
Contributor

@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

@borkdude
Copy link
Contributor

Made an issue here now: babashka/sci#790.

@borkdude
Copy link
Contributor

borkdude commented Oct 11, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bb Babashka enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants