summary refs log tree commit diff
path: root/lib/test.test.fnl
blob: 79581415efe18528c0ec4bbdb2f999c54492a9ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(let [{: describe :end test-end} (require :lib.test)]
  (fn add [x y] (let [x (or x 0)
                      y (or y 0)]
                  (+ x y)))
  (describe "add()" (fn [test]
                  (let [should "return the right number"]
                    (test {:given "two numbers"
                           : should
                           :actual (add 2 3)
                           :expected 5})
                    (test {:given "no arguments"
                           :should "return 0"
                           :actual (add)
                           :expected 0})
                    (test {:given "zero"
                           : should
                           :actual (add 0 4)
                           :expected 4}))
                  (test-end))))