Liking cljdoc? Tell your friends :D

hara.code.framework.test.clojure


gather-deftestclj

(gather-deftest nav)

Make docstring notation out of deftest form

(-> "^{:refer example/hello-world :added "0.1"} (deftest hello-world-test\n (is (= 1 1))\n (is (identical? 2 4)))" (nav/parse-string) nav/down nav/right nav/down nav/right nav/right (gather-deftest) (update-in [:test] docstring/->docstring)) => (contains '{:refer example/hello-world :ns example, :var hello-world, :added "0.1", :line {:row 2, :col 8, :end-row 4, :end-col 25}, :test "1\n => 1\n (identical? 2 4)\n => true"})

Make docstring notation out of deftest form

(-> "^{:refer example/hello-world :added \"0.1\"}
     (deftest hello-world-test\n  (is (= 1 1))\n  (is (identical? 2 4)))"
    (nav/parse-string)
    nav/down nav/right nav/down nav/right nav/right
    (gather-deftest)
    (update-in [:test] docstring/->docstring))
=> (contains '{:refer example/hello-world
               :ns example,
               :var hello-world,
               :added "0.1",
              :line {:row 2, :col 8, :end-row 4, :end-col 25},
               :test "1\n  => 1\n  (identical? 2 4)\n  => true"})
raw docstring

gather-deftest-bodyclj

(gather-deftest-body nav)
(gather-deftest-body nav output)

helper function for gather-deftest

(-> "(\n (is (= 1 1))^:hidden\n (is (identical? 2 4)))" (nav/parse-string) (nav/down) (gather-deftest-body) (docstring/->docstring)) => "\n 1\n => 1"

helper function for `gather-deftest`

(-> "(\n  (is (= 1 1))^:hidden\n  (is (identical? 2 4)))"
    (nav/parse-string)
    (nav/down)
    (gather-deftest-body)
    (docstring/->docstring))
=> "\n  1\n  => 1"
raw docstring

gather-is-formclj

(gather-is-form nav)

Make docstring notation out of is form (-> (nav/parse-string "(is (= 1 1))") (gather-is-form) (docstring/->docstring)) => "1\n => 1"

(-> (nav/parse-string "(is (boolean? 4))") (gather-is-form) (docstring/->docstring)) => "(boolean? 4)\n => true"

Make docstring notation out of is form
(-> (nav/parse-string "(is (= 1 1))")
    (gather-is-form)
    (docstring/->docstring))
=> "1\n  => 1"

(-> (nav/parse-string "(is (boolean? 4))")
    (gather-is-form)
    (docstring/->docstring))
=> "(boolean? 4)\n  => true"
raw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close