diff options
Diffstat (limited to 'test/test.fnl')
| -rw-r--r-- | test/test.fnl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/test/test.fnl b/test/test.fnl index ff7c8bc..9ee23c1 100644 --- a/test/test.fnl +++ b/test/test.fnl @@ -1,5 +1,19 @@ (require-macros :macros.fn) -;; requires `eq' from core.fnl to be available at runtime + +(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# (and res# (= count-a# count-b#)))) + res#) + (= a# b#)))) (fn* assert-eq ([expr1 expr2] |