Browse Source

add tests for addMetadata on abstracts (see #3500)

Simon Krajewski 10 years ago
parent
commit
bb42b4e076

+ 2 - 0
tests/misc/projects/Issue3500/A.hx

@@ -0,0 +1,2 @@
+@:bla
+abstract A(Int) { }

+ 18 - 0
tests/misc/projects/Issue3500/Main.hx

@@ -0,0 +1,18 @@
+class Main {
+	static function test() {
+		var t = haxe.macro.Context.getType("A");
+		function fail(msg) {
+			Sys.println(msg);
+			Sys.exit(1);
+		}
+		switch (t) {
+			case TAbstract(a, _):
+				var hasTestMeta = Lambda.exists(a.get().impl.get().meta.get(), function(m) return m.name == ":test");
+				if (!hasTestMeta) {
+					fail("Abstract implementation class has no @:test metadata");
+				}
+			case _:
+				fail("Should be abstract");
+		}
+	}
+}

+ 4 - 0
tests/misc/projects/Issue3500/compile.hxml

@@ -0,0 +1,4 @@
+--macro addMetadata('@:test', 'A')
+--macro Main.test()
+-neko n
+--no-output