conditional compilation \#cond
This commit is contained in:
@@ -33,4 +33,18 @@ class ConditionalCompilationTestCase extends Test {
|
||||
Assert.equals(12, number2());
|
||||
#end
|
||||
}
|
||||
|
||||
function testCond() {
|
||||
#if cpp
|
||||
Assert.equals("C++", targetLanguage);
|
||||
#elseif interp
|
||||
Assert.equals("Haxe", targetLanguage);
|
||||
#elseif js
|
||||
Assert.equals("JavaScript", targetLanguage);
|
||||
#elseif hxnodejs
|
||||
Assert.equals("NodeJS", targetLanguage);
|
||||
#elseif py
|
||||
Assert.equals("Python", targetLanguage);
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
@@ -13,4 +13,12 @@
|
||||
(#unless interp
|
||||
(+= num 5)
|
||||
(-= num 8))
|
||||
num))
|
||||
num))
|
||||
|
||||
(defvar targetLanguage
|
||||
(#cond
|
||||
(cpp "C++")
|
||||
(interp "Haxe")
|
||||
(hxnodejs "NodeJS")
|
||||
(js "JavaScript")
|
||||
(py "Python")))
|
Reference in New Issue
Block a user