Prechádzať zdrojové kódy

allow other issue directories in tests

Simon Krajewski 10 rokov pred
rodič
commit
201ccc88e5

+ 1 - 1
tests/unit/src/unit/Test.hx

@@ -314,7 +314,7 @@ class Test #if swf_mark implements mt.Protect #end {
 		#end
 		classes.push(new TestSpod(sys.db.Sqlite.open("db.db3")));
 		#end
-		TestIssues.addIssueClasses();
+		TestIssues.addIssueClasses("src/unit/issues", "unit.issues");
 		var current = null;
 		#if (!fail_eager)
 		try

+ 9 - 3
tests/unit/src/unit/TestIssues.hx

@@ -3,11 +3,17 @@ package unit;
 using StringTools;
 
 class TestIssues {
-	macro static public function addIssueClasses() {
-		var dir = sys.FileSystem.readDirectory("src/unit/issues");
+	macro static public function addIssueClasses(dir:String, pack:String) {
+		var dir = sys.FileSystem.readDirectory(dir);
 		var el = [];
 		function add(className:String) {
-			el.push(macro classes.push(new unit.issues.$className()));
+			var tp = {
+				pack: pack.split("."),
+				name: className,
+				sub: null,
+				params: null
+			}
+			el.push(macro classes.push(new $tp()));
 		}
 		for (file in dir) {
 			if (!file.endsWith(".hx")) {