Fork me on GitHub
#cursive
<
2022-04-26
>
Baye00:04:20

Hi. can I turnoff "symbol" abbreviation in Cursive: instead of F I want defn, instead of ∀ I want doseq...

cfleming00:04:17

Cursive doesn’t do that, do you have another plugin installed which does that?

imre07:04:12

Oh, I want to hear what that plugin is

cfleming08:04:01

I guess they’re ligatures, which is a built-in feature these days: https://www.jetbrains.com/webstorm/guide/tips/font-ligatures/. But there are still things like this around: https://plugins.jetbrains.com/plugin/14736-ligatures-limited

cfleming08:04:34

I have a feeling there was also a more Clojure-specific one, but I can’t find it now.

imre11:04:44

Thank you.

Baye12:04:05

I am not aware that I am using some other plug in, will double check now...

Baye12:04:29

yeah it was clojure pretty symbol doing it...Thanks

Ernesto Garcia08:04:46

Hi. This weekend I tried to work with Intellij + Cursive on Windows, on a project in the WSL (Windows Subsystem for Linux). Cursive seemed to be running tools.deps on Windows, and it failed if I had a git dependency in deps.edn. Would there be a way for Cursive to run tools.deps on WSL2? From what I saw, Intellij is running Maven and Git on WSL2 for such projects.

nottmey22:04:26

Hi everyone, I have a deps.edn alias :test and when running it with clj -M:test it executes all tests, but when I configure it in Cursive, it only executes some of them 😕

{:paths   ["src"]
 :deps    {com.datomic/client-api  {:mvn/version "1.0.58"}
           com.hyperfiddle/rcf     {:mvn/version "20220405"}
           com.walmartlabs/lacinia {:mvn/version "1.1"}
           org.clojure/clojure     {:mvn/version "1.11.1"}}
 :aliases {:repl {:extra-paths ["dev"]}
           :test {:extra-paths ["test"]
                  :extra-deps  {io.github.cognitect-labs/test-runner {:git/tag "v0.5.0" :git/sha "b3fd0d2"}}
                  :main-opts   ["-m" "cognitect.test-runner" "-d" "src" "-d" "test" "-r" "datomic-lacinia.*"]
                  :exec-fn     cognitect.test-runner.api/test
                  :jvm-opts    ["-Dhyperfiddle.rcf.generate-tests=true"]}}}
Does anyone have any advice on how to achieve the same behavior?

cfleming23:04:08

All those tests are in that module under the test folder, correct? I can’t see any reason why they wouldn’t be found. Is this a public project I could look at?

nottmey07:04:19

the schema-test is in the test folder, the rest ist in the src folder as https://github.com/hyperfiddle/rcf macros next to the implementation

nottmey07:04:12

the repo ist not public yet, but will be in the next days, I’ll let you know

imre07:04:05

I'm not convinced Cursive is able to discover those rcf tests

imre07:04:46

https://cursive-ide.com/userguide/testing.html says Currently the test integration only supports the default clojure.test

nottmey08:04:50

ok, fair point, rcf interacts with clojure.test, but if it actually generates clojure tests like deftest does, i don’t know

nottmey08:04:56

I guess I need to try with an own test macros what’s possible

cfleming08:04:51

I haven’t tried with rcf, but Dustin is a Cursive user, or at least was for a long time.

cfleming08:04:26

But I suspect that it might only look for tests under test roots, not source roots - I’d have to check the code for that though.

nottmey08:04:39

ok, I could test that hypothesis first (in my evening), if checking the code is too tedious

Dustin Getz15:04:51

RCF macroexpands to deftest when a JVM flag is set, i don't see why Cursive shouldn't pick it up, the theory about Cursive not looking in src directory makes the most sense to me

👌 1
imre15:04:16

> JVM flag is set curious

Dustin Getz15:04:17

It was not our intended use case to integrate with clojure.test at dev time, RCF is meant to be used at the REPL like rich comment forms, the deftest generation is meant for CI use case (to get test runners, reporters, coverage plugins etc). However we've gotten a bit of feedback that people want to integrate RCF into their old workflows. So we may support that officially in the future

nottmey19:04:44

yea, I see why it’s no direct concern, because the main usecases CI and REPL are covered. I would still argue that it would feel very natural to have them show up next to the “normal” tests (where people will still likely implement long running or integration tests). It would also be handy for them to be respected in coverage report of the IDE, so that one could easily add tests where coverage is missing. But I’m still very happy without this working, so no worries. For now I’m going to test whether deftests in src will be picked up, and whether rcf tests in test will be picked up.

nottmey20:04:03

Ok, RCF tests are picked up in test folder by cursive, but fail. (They succeed when run with clj -M:test ; for config, see above.)

(tests                ; in my case schema_test.clj line 8
  "true is true"
  true := true)
Testing datomic-lacinia.schema-test
.java.lang.ClassCastException: class java.lang.String cannot be cast to class clojure.lang.Symbol (java.lang.String is in module java.base of loader 'bootstrap'; clojure.lang.Symbol is in unnamed module of loader 'app')
 at clojure.core$find_ns.invokeStatic (core.clj:4127)
    clojure.core$the_ns.invokeStatic (core.clj:4161)
    clojure.core$ns_name.invokeStatic (core.clj:4165)
    clojure.core$ns_name.invoke (core.clj:4165)
    cursive.tests.runner$eval577$report__22180__auto____584.invoke (run-tests8310960651276941006.clj:81)
    clojure.test$do_report.invokeStatic (test.clj:357)
    clojure.test$do_report.invoke (test.clj:351)
    datomic_lacinia.schema_test$fn__557.invokeStatic (schema_test.clj:8)
    datomic_lacinia.schema_test/fn (schema_test.clj:8)
    clojure.test$test_var$fn__9856.invoke (test.clj:717)
    ...

nottmey20:04:06

Interesting, when I add one deftest to a src namespace, the test is picked up and RCF tests are also run

nottmey20:04:58

I like how interactive RCF feels, but I see that simply using deftest next to the implementation in src can feel pretty similar. My solution:

(deftest- uppercase-first-test
  (is (= (uppercase-first "hellO") "HellO"))
  (is (= (uppercase-first "s") "S"))
  (is (= (uppercase-first "S") "S"))
  (is (= (uppercase-first "") ""))
  (is (= (uppercase-first nil) nil)))
;; instead of
(tests
  (lowercase-first "HellO") := "hellO"
  (lowercase-first "S") := "s"
  (lowercase-first "s") := "s"
  (lowercase-first "") := ""
  (lowercase-first nil) := nil)
And a REPL Command:

cfleming22:04:27

That exception looks like a bug in Cursive, could you file an issue for that one and I’ll look at it?

nottmey22:04:03

yes, I can, will do 🙂

cfleming23:04:22

Great, thank you!