summary refs log tree commit diff
path: root/lib/test.test.fnl
diff options
context:
space:
mode:
authordozens2024-05-29 19:26:41 -0600
committerdozens2024-06-02 21:44:17 -0600
commit7c07d6e6ececbf73e18a639e00b3690d4827e12a (patch)
tree7d948da1b634d100feb32215dd5d263c5b01ab8b /lib/test.test.fnl
parentf265d24c0cacb92c7f7db19f364a155d87938184 (diff)
tests
Diffstat (limited to 'lib/test.test.fnl')
-rw-r--r--lib/test.test.fnl19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/test.test.fnl b/lib/test.test.fnl
new file mode 100644
index 0000000..7958141
--- /dev/null
+++ b/lib/test.test.fnl
@@ -0,0 +1,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))))