summaryrefslogtreecommitdiff
path: root/test/test.fnl
diff options
context:
space:
mode:
authorAndrey Orst <andreyorst@gmail.com>2020-11-12 19:25:57 +0300
committerAndrey Orst <andreyorst@gmail.com>2020-11-12 19:25:57 +0300
commita1851986383148593ca85675d3dafd1e8517481a (patch)
treea99dbf637b2f5fb6f1465695eee71a9d008fd80e /test/test.fnl
parent32f268f51538bd4c26d9da337e01d3df39ea2f2e (diff)
fix(CI): overhaul
Diffstat (limited to 'test/test.fnl')
-rw-r--r--test/test.fnl58
1 files changed, 0 insertions, 58 deletions
diff --git a/test/test.fnl b/test/test.fnl
deleted file mode 100644
index a83b510..0000000
--- a/test/test.fnl
+++ /dev/null
@@ -1,58 +0,0 @@
-(local test {})
-
-(fn eq-fn []
- `(fn eq# [a# b#]
- (if (and (= (type a#) :table) (= (type b#) :table))
- (do (var [res# count-a# count-b#] [true 0 0])
- (each [k# v# (pairs a#)]
- (set res# (eq# v# (. b# k#)))
- (set count-a# (+ count-a# 1))
- (when (not res#) (lua :break)))
- (when res#
- (each [_# _# (pairs b#)]
- (set count-b# (+ count-b# 1)))
- (set res# (= count-a# count-b#)))
- res#)
- (= a# b#))))
-
-(fn test.assert-eq
- [expr1 expr2 msg]
- `(let [left# ,expr1
- right# ,expr2
- (res# view#) (pcall require :fennelview)
- eq# ,(eq-fn)
- tostr# (if res# view# tostring)]
- (assert (eq# left# right#)
- (or ,msg (.. "equality assertion failed
- Left: " (tostr# left#) "
- Right: " (tostr# right#) "\n")))))
-
-(fn test.assert-ne
- [expr1 expr2 msg]
- `(let [left# ,expr1
- right# ,expr2
- (res# view#) (pcall require :fennelview)
- eq# ,(eq-fn)
- tostr# (if res# view# tostring)]
- (assert (not (eq# left# right#))
- (or ,msg (.. "unequality assertion failed
- Left: " (tostr# left#) "
- Right: " (tostr# right#) "\n")))))
-
-(fn test.assert*
- [expr msg]
- `(assert ,expr (.. "assertion failed for "
- (or ,msg ,(tostring expr)))))
-
-(fn test.deftest
- [name ...]
- "Simple way of grouping tests"
- `,((or table.unpack _G.unpack) [...]))
-
-(fn test.testing
- [description ...]
- "Define test function, print its name and run it."
- `(do (io.stderr:write (.. "testing: " ,description "\n"))
- ,((or table.unpack _G.unpack) [...])))
-
-test