Przeglądaj źródła

[tests] add tests

closes #10034
closes #10135
Simon Krajewski 4 lat temu
rodzic
commit
06c1f56cc5

+ 13 - 0
tests/misc/projects/Issue10034/Main.hx

@@ -0,0 +1,13 @@
+#if macro
+class Foo {
+	public static function build(f:() -> Void)
+		return [];
+
+	public static function other():Void {}
+}
+#else
+@:build(Foo.build(Foo.other))
+class Main {}
+
+class Foo {}
+#end

+ 1 - 0
tests/misc/projects/Issue10034/compile-fail.hxml

@@ -0,0 +1 @@
+--main Main

+ 2 - 0
tests/misc/projects/Issue10034/compile-fail.hxml.stderr

@@ -0,0 +1,2 @@
+Main.hx:9: characters 19-28 : haxe.macro.Expr should be () -> Void
+Main.hx:9: characters 19-28 : ... For function argument 'f'

+ 18 - 0
tests/unit/src/unit/issues/Issue10135.hx

@@ -0,0 +1,18 @@
+package unit.issues;
+
+class Issue10135 extends Test {
+	function doEncode() {
+		var w = 0;
+
+		var i = 0;
+		while (Math.random() > 0.5) {
+			while (i < 80) {
+				w = 1;
+			}
+		}
+	}
+
+	function test() {
+		utest.Assert.pass();
+	}
+}