Made it show how many skipped known bugs

This commit is contained in:
NeeEoo
2024-04-23 04:09:25 +02:00
parent 934848ff8d
commit d2aa99eff7
3 changed files with 17 additions and 4 deletions
+12
View File
@@ -48,6 +48,16 @@ class Util {
static var totalTestUnits:Int = 0;
static var passedTestUnits:Int = 0;
static var failedTestUnits:Int = 0;
static var skippedKnownBugs:Int = 0;
public static function runKnownBug(name:String, func:Void->Void) {
if (Main.SHOW_KNOWN_BUGS) {
Sys.println("Running known bug: " + name);
func();
} else {
skippedKnownBugs++;
}
}
public static function startUnitTest(path:String) {
//Sys.println("Running unit tests " + path);
@@ -65,6 +75,8 @@ class Util {
Sys.println("Total Units: " + totalTestUnits);
Sys.println("Total tests passed: " + passedTestUnits);
Sys.println("Total tests failed: " + failedTestUnits);
if(skippedKnownBugs > 0)
Sys.println("Skipped known bugs: " + skippedKnownBugs);
//Sys.println("Finished unit tests " + currentTestPath.pop());
}
+3 -2
View File
@@ -259,18 +259,19 @@ function f3() {
return 3;
}
if(Main.SHOW_KNOWN_BUGS) {
Util.runKnownBug("Function arguments get called first, before function is evaluated", () ->{
var end = begin();
d.f1()(f3());
d.f1(f2());
assertEq('var end = begin();
// Expected internal behavior for `d.f1()(f3());`
//var func = d.f1();
//func(f3());
d.f1()(f3());
d.f1(f2());
end()', end());
}
});
}
override function teardown() {
+2 -2
View File
@@ -11,11 +11,11 @@ class MiscCase extends TestCase {
assertEq("false", false);
assertEq("null", null);
if(Main.SHOW_KNOWN_BUGS) {
Util.runKnownBug("Redefining a variable with the same name as a function", () ->{
// Redefining a function with the same name as a variable
var a = 1; function a() { return 4; }
assertEq("var a = 1; function a() { return 4; }; a", a);
}
});
var a = 1; var a = 2;
assertEq("var a = 1; var a = 2; a", a);