From d2aa99eff785e37a2f04e9bc8e50de8a2c99406b Mon Sep 17 00:00:00 2001 From: NeeEoo Date: Tue, 23 Apr 2024 04:09:25 +0200 Subject: [PATCH] Made it show how many skipped known bugs --- tests/src/Util.hx | 12 ++++++++++++ tests/src/tests/EvalOrderCase.hx | 5 +++-- tests/src/tests/MiscCase.hx | 4 ++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/tests/src/Util.hx b/tests/src/Util.hx index 642dd5c..d03842b 100644 --- a/tests/src/Util.hx +++ b/tests/src/Util.hx @@ -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()); } diff --git a/tests/src/tests/EvalOrderCase.hx b/tests/src/tests/EvalOrderCase.hx index a5fab40..9170717 100644 --- a/tests/src/tests/EvalOrderCase.hx +++ b/tests/src/tests/EvalOrderCase.hx @@ -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() { diff --git a/tests/src/tests/MiscCase.hx b/tests/src/tests/MiscCase.hx index fbe1499..4b94246 100644 --- a/tests/src/tests/MiscCase.hx +++ b/tests/src/tests/MiscCase.hx @@ -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);