This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-01-30
Channels
- # admin-announcements (1)
- # announcements (1)
- # babashka (8)
- # bristol-clojurians (1)
- # calva (36)
- # clojure (115)
- # clojure-europe (5)
- # clojure-italy (4)
- # clojure-nl (3)
- # clojure-norway (3)
- # clojure-uk (161)
- # clojuredesign-podcast (3)
- # clojurescript (71)
- # core-async (34)
- # cursive (26)
- # datomic (43)
- # docker (2)
- # emacs (24)
- # figwheel-main (1)
- # fulcro (36)
- # graalvm (7)
- # immutant (2)
- # jackdaw (1)
- # jobs (2)
- # leiningen (8)
- # luminus (5)
- # off-topic (29)
- # onyx (1)
- # other-languages (5)
- # pathom (6)
- # pedestal (3)
- # reagent (11)
- # ring (8)
- # shadow-cljs (42)
- # spacemacs (17)
- # specter (6)
- # tools-deps (80)
- # videos (1)
here's what i got for that:
$ ./bb
Babashka v0.0.67 REPL.
Use :repl/quit or :repl/exit to quit the REPL.
Clojure rocks, Bash reaches.
user=> (require '[clojure.test :refer [is deftest] :as t])
nil
user=> (defmethod t/assert-expr 'roughly [msg form]
`(let [op1# ~(nth form 1)
op2# ~(nth form 2)
tolerance# (if (= 4 ~(count form)) ~(last form) 2)
decimals# (/ 1. (Math/pow 10 tolerance#))
result# (< (Math/abs (- op1# op2#)) decimals#)]
(t/do-report
{:type (if result# :pass :fail)
:message ~msg
:expected (format "%s should be roughly %s with %s tolerance"
op1# op2# decimals#)
:actual result#})
result#))
#object[clojure.lang.MultiFn 0x61a22b2d "clojure.lang.MultiFn@5573e76be080"]
user=> (deftest PI-test
(is (roughly 3.14 Math/PI 2))
(is (roughly 3.14 Math/PI 3)))
#'user/PI-test
user=> (t/test-var #'PI-test)
FAIL in (PI-test) (test.clj:370)
expected: "3.14 should be roughly 3.141592653589793 with 0.001 tolerance"
actual: false
nil
with 0.0.67 bundling clojure.test, spartan.test is now deprecated: https://github.com/borkdude/spartan.test/blob/master/README.md
Small test runner: https://github.com/borkdude/babashka/#running-tests
Are there plans to implement ns-map
, ns-aliases
and ns-publics
on bb?
This could allow a simple autocomplete to work 😁
@mauricio.szabo ns-aliases
and ns-publics
and ns-interns
should work now