From 1f88cd3b8eadeab2518519a97683067ec777eb6e Mon Sep 17 00:00:00 2001 From: Andrey Orst Date: Mon, 9 Nov 2020 21:26:25 +0300 Subject: fix(testing): do not depend on eq from core --- test/test.fnl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'test/test.fnl') 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] -- cgit v1.2.3