move assertEquals to language core

This commit is contained in:
2023-02-19 07:11:42 -07:00
parent 25ce490196
commit 0876652199
2 changed files with 8 additions and 1 deletions

View File

@@ -386,6 +386,12 @@ class Macros {
} }
}; };
k.doc("assertEquals", 2, null, "(assertEquals <expected> <actual> <?more actual...>)");
macros["assertEquals"] = (wholeExp:ReaderExp, exps:Array<ReaderExp>, k:KissState) -> {
var b = wholeExp.expBuilder();
b.callSymbol("assert", [b.callSymbol("=", exps)]);
}
function stringsThatMatch(exp:ReaderExp, formName:String) { function stringsThatMatch(exp:ReaderExp, formName:String) {
return switch (exp.def) { return switch (exp.def) {
case StrExp(s): case StrExp(s):

View File

@@ -341,7 +341,8 @@
From:[(assert false (+ \"false \" \"should \" \"have \" \"been \" \"true\"))]" message))) From:[(assert false (+ \"false \" \"should \" \"have \" \"been \" \"true\"))]" message)))
(assert true) (assert true)
(assert ![])) (assert ![])
(assertEquals 6 6 6))
(function _testApply [] (function _testApply []
(Assert.equals 6 (apply + [1 2 3]))) (Assert.equals 6 (apply + [1 2 3])))