compileToFile() working for hello world

This commit is contained in:
2021-07-25 23:55:52 -06:00
parent dcaf0a1a7f
commit 206ab8972d
5 changed files with 141 additions and 24 deletions

View File

@@ -9,15 +9,15 @@ import haxe.macro.Context;
#end
class CompilerToolsTestCase extends Test {
function testCompileHelloWorld() {
Assert.equals("Hello, world!", _testCompileHelloWorld());
function testCompileHelloWorldJs() {
Assert.equals("Hello world!", _testCompileHelloWorldJs());
}
static macro function _testCompileHelloWorld() {
static macro function _testCompileHelloWorldJs() {
var runHelloWorld = CompilerTools.compileFileToScript(
"kiss/template/src/template/Main.kiss", {
lang: JavaScript,
outputFolder: "bin/js",
outputFolder: "bin/helloWorldJsTest",
});
return {
@@ -25,4 +25,25 @@ class CompilerToolsTestCase extends Test {
expr: EConst(CString(runHelloWorld(), DoubleQuotes))
};
}
function testCompileHelloWorldPy() {
Assert.equals("Hello world!", _testCompileHelloWorldPy());
}
static macro function _testCompileHelloWorldPy() {
var runHelloWorld = CompilerTools.compileFileToScript(
"kiss/template/src/template/Main.kiss", {
lang: Python,
outputFolder: "bin/helloWorldPyTest",
});
return {
pos: Context.currentPos(),
expr: EConst(CString(runHelloWorld(), DoubleQuotes))
};
}
// TODO test what happens when passing more arguments/files
}