This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-10
Channels
- # beginners (50)
- # cider (112)
- # cljs-dev (7)
- # clojure (34)
- # clojure-brasil (1)
- # clojure-greece (4)
- # clojure-italy (8)
- # clojure-nl (14)
- # clojure-russia (4)
- # clojure-uk (94)
- # clojurescript (96)
- # clojutre (5)
- # cloverage (1)
- # cursive (5)
- # datomic (59)
- # docs (53)
- # figwheel (4)
- # fulcro (1)
- # hoplon (1)
- # hyperfiddle (3)
- # jobs (3)
- # luminus (6)
- # nyc (3)
- # off-topic (9)
- # onyx (3)
- # overtone (4)
- # re-frame (2)
- # reagent (16)
- # reitit (9)
- # ring (2)
- # ring-swagger (1)
- # rum (1)
- # shadow-cljs (81)
- # spacemacs (14)
- # specter (12)
- # sql (1)
- # tools-deps (2)
- # vim (110)
Anyone using Specter? How does one make something like clojure.walk, e.g. I want to walk a datastructure and swap all sequences for vectors
I believe this will do the job in Specter - but may want to ask in #specter if this isn't sufficient for your purposes
not specter but you could do this:
(clojure.walk/postwalk
#(if (seq? %)
(vec %)
%)
[1 2 '(3 4 5) {:x '(6 7 8)}])
;;=>
;;[1 2 [3 4 5] {:x [6 7 8]}]
what is the best way to run a unit test many many times?
looking for an easy way to do this from the repl
but I only want 1 specific test to run
I should be
do you want it to run constantly as you're editing code to see it turn green as your code?
it’s a bit more of an integration test really
and there is apparently a race condition somewhere
no, it’s a flaky test
fails very rarely
I might need something like (while (my-fixture my-test-fn) :another-try)
hmmm… (my-fixture my-test-fn) returns nil
apparently the deftest macro does not return the value of the last expression
ah yes you shouldn't use the deftest name, unfortunately you'll need to use a temporary intermediate fn
@cpmcdaniel to run a test with all applicable fixtures, use clojure.test/test-var
=> (clojure.repl/doc clojure.test/test-var)
-------------------------
clojure.test/test-var
([v])
If v has a function in its :test metadata, calls that function,
with *testing-vars* bound to (conj *testing-vars* v).
nil
also, for flaky tests, I am fond of making a fixture like (defn flake-fixture [f] (dotimes [n 1000] (println 'run n) (f)))
my team is deciding on a standard formatter - most use Cursive or are switching to Cursive (from Atom), I'm the lone Emacs user 😞
@lilactown I asked that before, apparently no, seems like is tightly integrated with IntelliJ stuff
I've had good luck with cljfmt
which has editor integration, and lein cljfmt fix
can be used in CI to auto-fix indentation and whitespace issues in place
I believe this will do the job in Specter - but may want to ask in #specter if this isn't sufficient for your purposes
=> {:a [[:x 1] [2 3 4]], :b {:c [4], :d [5], :e [0 1 2 3 4 5 6 7 8 9]}}