BasicTestCase
This commit is contained in:
@@ -1,6 +1,2 @@
|
||||
(defvar message "Hello, world!")
|
||||
(defvar math #|5 + 6 * 3|#) // inject raw haxe
|
||||
(defun floor [num] (Math.floor num))
|
||||
(defun main []
|
||||
(trace message)
|
||||
(trace (floor 7.5)))
|
||||
(trace "Hello, world!"))
|
||||
23
src/test/cases/BasicTestCase.hx
Normal file
23
src/test/cases/BasicTestCase.hx
Normal file
@@ -0,0 +1,23 @@
|
||||
package test.cases;
|
||||
|
||||
import utest.Test;
|
||||
import utest.Assert;
|
||||
|
||||
@:build(kiss.Kiss.build("src/test/cases/BasicTestCase.kiss"))
|
||||
class BasicTestCase extends Test {
|
||||
function testStaticVar() {
|
||||
Assert.equals("Howdy", BasicTestCase.message);
|
||||
}
|
||||
|
||||
function testHaxeInsertion() {
|
||||
Assert.equals(23, BasicTestCase.mathResult);
|
||||
}
|
||||
|
||||
function testStaticFunction() {
|
||||
Assert.equals(6, BasicTestCase.myFloor(6.5));
|
||||
}
|
||||
|
||||
function testFuncall() {
|
||||
Assert.equals(7, BasicTestCase.funResult);
|
||||
}
|
||||
}
|
||||
10
src/test/cases/BasicTestCase.kiss
Normal file
10
src/test/cases/BasicTestCase.kiss
Normal file
@@ -0,0 +1,10 @@
|
||||
// (defvar) declares static variables
|
||||
(defvar message "Howdy")
|
||||
// #| ... |# parses and injects raw Haxe code
|
||||
(defvar mathResult #|5 + 6 * 3|#) // Order of operations will apply
|
||||
// (defun) declares static functions
|
||||
(defun myFloor [num]
|
||||
// funcalls can use dot access
|
||||
(Math.floor num))
|
||||
// functions are resolved in the macro context
|
||||
(defvar funResult (myFloor 7.5))
|
||||
Reference in New Issue
Block a user