Przeglądaj źródła

[display] allow running a single display test + add issue template (#7058)

* [display] allow running a single display test + add issue template

* I guess Path.directory() doesn't work here, huh.
Jens Fischer 7 lat temu
rodzic
commit
92afdfb5a7

+ 5 - 0
tests/display/.vscode/settings.json

@@ -0,0 +1,5 @@
+{
+	"haxe.displayConfigurations": [
+		{"label": "IssueTemplate", "args": ["build.hxml", "-D", "test=IssueTemplate"]}
+	]
+}

+ 2 - 2
tests/display/.vscode/tasks.json

@@ -2,8 +2,8 @@
 	"version": "2.0.0",
 	"tasks": [
 		{
-			"type": "hxml",
-			"file": "build.hxml",
+			"type": "haxe",
+			"args": "active configuration",
 			"group": {
 				"kind": "build",
 				"isDefault": true

+ 5 - 0
tests/display/src/Macro.hx

@@ -4,6 +4,7 @@ import haxe.io.Path;
 
 using sys.FileSystem;
 using Lambda;
+using StringTools;
 
 class Macro {
 	static function buildTestCase():Array<Field> {
@@ -52,9 +53,13 @@ class Macro {
 
 	macro static public function getCases(pack:String) {
 		var cases = [];
+		var singleCase = haxe.macro.Compiler.getDefine("test");
 		function loop(pack:Array<String>) {
 			var path = Context.resolvePath(Path.join(pack));
 			for (file in sys.FileSystem.readDirectory(path)) {
+				if (singleCase != null && !file.endsWith(singleCase + ".hx")) {
+					continue;
+				}
 				var p = new haxe.io.Path(file);
 				if (p.ext == "hx") {
 					var tp = {pack: pack, name: p.file};

+ 14 - 0
tests/display/src/cases/IssueTemplate.hx

@@ -0,0 +1,14 @@
+package cases;
+
+class IssueTemplate extends DisplayTestCase {
+	/**
+	class Main {
+		static function main() {
+			{-1-}
+		}
+	}
+	**/
+	function test() {
+
+	}
+}