fix undefinition of print before other MacroTestCases

This commit is contained in:
2021-11-09 15:39:43 -07:00
parent 30c465617d
commit 8dcd3cf89b
3 changed files with 27 additions and 3 deletions

View File

@@ -25,7 +25,8 @@ class MacroTestCase extends Test {
}
function testUndefAlias() {
Assert.equals(9, print);
Assert.equals(9, chooseRandom);
Assert.equals(6, print(5));
Assert.equals(9, aliasValue());
}

View File

@@ -98,4 +98,27 @@
(Assert.equals "intended" (_testTryCatchWithoutDynamicMacro)))
(function _testAssertReturnsValue []
(Assert.equals true (assert true)))
(Assert.equals true (assert true)))
// DANGEROUS tests:
// (don't add new tests below here, because these tests redefine important forms)
// If for whatever reason, you wanted to make a variable with the name of a built-in identifier alias:
(undefAlias &ident chooseRandom)
(var chooseRandom 9)
// Also if you want a function called print:
(undefAlias &call print)
(function print [thing] (+ 1 thing))
(defAlias &ident alias 5)
(undefAlias &ident alias)
(var alias 9)
(function aliasValue [] alias)
// If for whatever reason, you wanted to make a function called and
(undefMacro and)
(function and [a b] (+ a b))
(function andValue [] (and 5 6))