Refactor MacroExpandTestCase
This commit is contained in:
@@ -14,12 +14,9 @@ using StringTools;
|
|||||||
|
|
||||||
@:build(kiss.Kiss.build())
|
@:build(kiss.Kiss.build())
|
||||||
class MacroExpandTestCase extends Test {
|
class MacroExpandTestCase extends Test {
|
||||||
function testObjectFormWithAlias() {
|
function testAllForms() {
|
||||||
_testObjectFormWithAlias();
|
_testAllForms();
|
||||||
}
|
Assert.pass();
|
||||||
|
|
||||||
function testLambdaFormWithAlias() {
|
|
||||||
_testLambdaFormWithAlias();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,31 +1,20 @@
|
|||||||
(defAlias &ident Stream kiss.Stream)
|
(defAlias &ident Stream kiss.Stream)
|
||||||
|
|
||||||
(defMacroFunction example []
|
(defMacro makeExample [expression &body b]
|
||||||
`(object
|
`(let [normal ,(printExp expression)
|
||||||
Stream (Stream.fromString "")))
|
expanded ,(printExp (macroExpand expression))]
|
||||||
|
,@b))
|
||||||
|
|
||||||
(defMacro normalExample []
|
(function _testAllForms []
|
||||||
(printExp (example)))
|
(makeExample
|
||||||
|
(object
|
||||||
|
Stream (Stream.fromString ""))
|
||||||
|
normal.Stream
|
||||||
|
expanded.Stream)
|
||||||
|
|
||||||
(defMacro macroExpandExample []
|
(makeExample
|
||||||
(printExp (macroExpand (example))))
|
(lambda [Stream] (Stream.fromString ""))
|
||||||
|
(normal null)
|
||||||
(function _testObjectFormWithAlias []
|
(expanded null))
|
||||||
.Stream (normalExample)
|
|
||||||
.Stream (macroExpandExample)
|
|
||||||
(Assert.pass))
|
|
||||||
|
|
||||||
(defMacroFunction example2 []
|
|
||||||
`(lambda [Stream] (Stream.fromString "")))
|
|
||||||
|
|
||||||
(defMacro normalExample2 []
|
|
||||||
(printExp (example2)))
|
|
||||||
|
|
||||||
(defMacro macroExpandExample2 []
|
|
||||||
(printExp (macroExpand (example2))))
|
|
||||||
|
|
||||||
(function _testLambdaFormWithAlias []
|
|
||||||
(localVar l (normalExample2))
|
|
||||||
(localVar l2 (macroExpandExample2))
|
|
||||||
(Assert.pass))
|
|
||||||
|
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user