[#21]: test for lifecycle private fn with args
This commit is contained in:
parent
f2f4c1f3ea
commit
325eecf0c9
2 changed files with 23 additions and 0 deletions
|
|
@ -9,12 +9,17 @@
|
|||
(defn g [a b]
|
||||
(+ a b))
|
||||
|
||||
(defn- pf [n]
|
||||
(+ 41 n))
|
||||
|
||||
(defstate scalar :start 42)
|
||||
(defstate fun :start #(inc 41))
|
||||
(defstate with-fun :start (inc 41))
|
||||
(defstate with-partial :start (partial g 41))
|
||||
(defstate f-in-f :start (f 41))
|
||||
(defstate f-args :start g)
|
||||
(defstate f-value :start (g 41 1))
|
||||
(defstate private-f :start pf)
|
||||
|
||||
(defn with-fun-and-values [f]
|
||||
(mount/start #'check.fun-with-values-test/scalar
|
||||
|
|
@ -22,6 +27,8 @@
|
|||
#'check.fun-with-values-test/with-fun
|
||||
#'check.fun-with-values-test/with-partial
|
||||
#'check.fun-with-values-test/f-in-f
|
||||
#'check.fun-with-values-test/f-args
|
||||
#'check.fun-with-values-test/private-f
|
||||
#'check.fun-with-values-test/f-value)
|
||||
(f)
|
||||
(mount/stop))
|
||||
|
|
@ -34,4 +41,6 @@
|
|||
(is (= with-fun 42))
|
||||
(is (= (with-partial 1) 42))
|
||||
(is (= (f-in-f 1) 42))
|
||||
(is (= (f-args 41 1) 42))
|
||||
(is (= (private-f 1) 42))
|
||||
(is (= f-value 42)))
|
||||
|
|
|
|||
14
test/check/private_fun_test.clj
Normal file
14
test/check/private_fun_test.clj
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
(ns check.private-fun-test
|
||||
(:require [mount.core :as mount :refer [defstate]]
|
||||
[check.fun-with-values-test :refer [private-f]]
|
||||
[clojure.test :refer :all]))
|
||||
|
||||
(defn with-fun-and-values [f]
|
||||
(mount/start #'check.fun-with-values-test/private-f)
|
||||
(f)
|
||||
(mount/stop))
|
||||
|
||||
(use-fixtures :each with-fun-and-values)
|
||||
|
||||
(deftest fun-with-valuesj
|
||||
(is (= (private-f 1) 42)))
|
||||
Loading…
Reference in a new issue