This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-04-26
Channels
- # babashka (7)
- # beginners (85)
- # calva (39)
- # cider (3)
- # clara (1)
- # clj-kondo (10)
- # clojure (194)
- # clojure-europe (36)
- # clojure-madison (2)
- # clojure-nl (13)
- # clojure-spec (11)
- # clojure-uk (2)
- # clojurescript (17)
- # community-development (5)
- # component (9)
- # conjure (4)
- # core-async (3)
- # cursive (32)
- # data-science (26)
- # datomic (31)
- # graalvm (22)
- # holy-lambda (31)
- # honeysql (7)
- # introduce-yourself (1)
- # jobs (9)
- # jobs-rus (1)
- # lsp (3)
- # malli (9)
- # off-topic (54)
- # pathom (27)
- # pedestal (6)
- # portal (1)
- # re-frame (4)
- # releases (1)
- # remote-jobs (1)
- # sci (3)
- # shadow-cljs (4)
- # spacemacs (13)
- # vim (14)
- # xtdb (3)
Hi. can I turnoff "symbol" abbreviation in Cursive: instead of F I want defn, instead of ∀ I want doseq...
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
I have a feeling there was also a more Clojure-specific one, but I can’t find it now.
I think you mean this one: https://plugins.jetbrains.com/plugin/8224-clojure-pretty-symbol
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.
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?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?
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
https://cursive-ide.com/userguide/testing.html says Currently the test integration only supports the default clojure.test
ok, fair point, rcf interacts with clojure.test, but if it actually generates clojure tests like deftest does, i don’t know
I haven’t tried with rcf, but Dustin is a Cursive user, or at least was for a long time.
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.
ok, I could test that hypothesis first (in my evening), if checking the code is too tedious
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
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
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.
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)
...
Interesting, when I add one deftest to a src namespace, the test is picked up and RCF tests are also run
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: