Jelajahi Sumber

start some simple testing (js-only for now)

Dan Korostelev 4 tahun lalu
induk
melakukan
2ddd6f93f2

+ 1 - 0
tests/misc/coroutines/.gitignore

@@ -0,0 +1 @@
+/test.js

+ 29 - 0
tests/misc/coroutines/Test.hx

@@ -0,0 +1,29 @@
+import utest.Assert;
+import utest.Async;
+
+class TestStaticFields extends utest.Test {
+	function testSimpleStart(async:Async) {
+		simple.start(42, result -> {
+			Assert.equals(42, result);
+			async.done();
+		});
+	}
+
+	function testSimpleCreate(async:Async) {
+		var cont = simple.create(42, result -> {
+			Assert.equals(42, result);
+			async.done();
+		});
+		cont(null);
+	}
+
+	@:coroutine static function simple(arg:Int):Int {
+		return arg;
+	}
+}
+
+function main() {
+	utest.UTest.run([
+		new TestStaticFields(),
+	]);
+}

+ 5 - 0
tests/misc/coroutines/build.hxml

@@ -0,0 +1,5 @@
+--class-path .
+--library utest
+--main Test
+--js test.js
+--cmd node test.js

+ 4 - 0
tests/runci/targets/Js.hx

@@ -57,6 +57,10 @@ class Js {
 		changeDirectory(miscDir + "es6");
 		runCommand("haxe", ["run.hxml"]);
 
+		infoMsg("Test coroutines:");
+		changeDirectory(miscDir + "coroutines");
+		runCommand("haxe", ["build.hxml"]);
+
 		haxelibInstallGit("HaxeFoundation", "hxnodejs");
 		var env = Sys.environment();
 		if (