fix undefinition of print before other MacroTestCases
This commit is contained in:
@@ -85,7 +85,7 @@ class KissInterp extends Interp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override function exprReturn(e):Dynamic {
|
override function exprReturn(e):Dynamic {
|
||||||
// the default exprReturn() contains a try-catch which, though it is important, hides very important macroexpansion callstacks sometimes
|
// the default exprReturn() contains a try-catch which, though it is important (break, continue, and return statements require it), hides very important macroexpansion callstacks sometimes
|
||||||
#if macrotest
|
#if macrotest
|
||||||
return expr(e);
|
return expr(e);
|
||||||
#else
|
#else
|
||||||
|
@@ -25,7 +25,8 @@ class MacroTestCase extends Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testUndefAlias() {
|
function testUndefAlias() {
|
||||||
Assert.equals(9, print);
|
Assert.equals(9, chooseRandom);
|
||||||
|
Assert.equals(6, print(5));
|
||||||
Assert.equals(9, aliasValue());
|
Assert.equals(9, aliasValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -98,4 +98,27 @@
|
|||||||
(Assert.equals "intended" (_testTryCatchWithoutDynamicMacro)))
|
(Assert.equals "intended" (_testTryCatchWithoutDynamicMacro)))
|
||||||
|
|
||||||
(function _testAssertReturnsValue []
|
(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))
|
||||||
|
Reference in New Issue
Block a user