浏览代码

[tests] add test for #8737 (#11970)

Rudy Ges 7 月之前
父节点
当前提交
cb202c4a5c
共有 1 个文件被更改,包括 48 次插入0 次删除
  1. 48 0
      tests/display/src/cases/Issue8737.hx

+ 48 - 0
tests/display/src/cases/Issue8737.hx

@@ -0,0 +1,48 @@
+package cases;
+
+class Issue8737 extends DisplayTestCase {
+	/**
+		class Main {
+			static function main() {
+				#if macro
+				te{-1-}st;
+				#else
+				te{-2-}st;
+				#end
+			}
+
+			/** Test doc **\/
+			macro static function {-4-}test{-5-}() {
+				te{-3-}st;
+				return macro null;
+			}
+		}
+	**/
+	function test() {
+		function check(i:Int) {
+			eq("() -> haxe.macro.Expr", type(pos(i)));
+			eq("Test doc", doc(pos(i)));
+			eq(range(4, 5), position(pos(i)));
+		}
+
+		for (i in 1...4) check(i);
+	}
+
+	/**
+		class Main {
+			static function main() {
+				te{-1-}st();
+			}
+
+			/** Test doc **\/
+			macro static function {-2-}test{-3-}() {
+				return macro null;
+			}
+		}
+	**/
+	function testSimple() {
+		eq("() -> haxe.macro.Expr", type(pos(1)));
+		eq("Test doc", doc(pos(1)));
+		eq(range(2, 3), position(pos(1)));
+	}
+}