new failing macro test cases

This commit is contained in:
2021-10-13 11:14:42 -06:00
parent 547082c512
commit bdc23b1eca
2 changed files with 30 additions and 0 deletions

View File

@@ -32,4 +32,12 @@ class MacroTestCase extends Test {
function testUndefMacro() {
Assert.equals(11, andValue());
}
function testRecursiveMacroFunction() {
_testRecursiveMacroFunction();
}
function testPrintAtMacroTime() {
_testPrintAtMacroTime();
}
}

View File

@@ -49,3 +49,25 @@
(undefMacro and)
(function and [a b] (+ a b))
(function andValue [] (and 5 6))
(defMacro listOfExp [exp times]
(let [times (eval times)]
(_listOfExp exp times)))
(defMacroFunction _listOfExp [exp times]
(case times
(1 `[,exp])
(otherwise `(.concat ,(_listOfExp exp 1) ,(_listOfExp exp (- times 1))))))
(function _testRecursiveMacroFunction []
(Assert.equals (Std.string [10 10 10 10 10 10 10 10 10 10]) (Std.string (listOfExp 10 10))))
(defMacroFunction printAtMacroTime []
~"Print at macro time should work just fine"
`null)
(defMacro _testPrintAtMacroTimeMacro []
(printAtMacroTime))
(function testPrintAtMacroTime []
(_testPrintAtMacroTimeMacro))