From 2b23a94776abe272d60e8dfe3f09202329bd8d70 Mon Sep 17 00:00:00 2001 From: Rudy Ges Date: Tue, 18 Apr 2023 13:43:20 +0200 Subject: [PATCH] [tests] add more debug data --- tests/server/src/cases/CsSafeTypeBuilding.hx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/server/src/cases/CsSafeTypeBuilding.hx b/tests/server/src/cases/CsSafeTypeBuilding.hx index 6ed271483e3..d977be7d7c9 100644 --- a/tests/server/src/cases/CsSafeTypeBuilding.hx +++ b/tests/server/src/cases/CsSafeTypeBuilding.hx @@ -22,25 +22,23 @@ class CsSafeTypeBuilding extends TestCase { vfs.putContent("Main.hx", getTemplate("csSafeTypeBuilding/Main.hx")); } + #if debug + function _assertHasPrint(s:String, ?pos:haxe.PosInfos) { + if (!assertHasPrint(s)) haxe.Log.trace("Fail", pos); + } + #end + function assertResult(target:String) { + #if debug var assertHasPrint = _assertHasPrint; #end assertSuccess(); // Make sure all types are generated - #if debug - if (!assertHasPrint("[runtime] Hello from Bar")) trace("Fail"); - if (!assertHasPrint("[runtime] Hello from Baz")) trace("Fail"); - if (!assertHasPrint("[runtime] Hello from Foo__Bar__Bar")) trace("Fail"); - if (!assertHasPrint("[runtime] Hello from Foo__Baz__Baz")) trace("Fail"); - if (!assertHasPrint("[runtime] Hello from Foo__Main__Main")) trace("Fail"); - if (!assertHasPrint("[runtime] Hello from Main")) trace("Fail"); - #else assertHasPrint("[runtime] Hello from Bar"); assertHasPrint("[runtime] Hello from Baz"); assertHasPrint("[runtime] Hello from Foo__Bar__Bar"); assertHasPrint("[runtime] Hello from Foo__Baz__Baz"); assertHasPrint("[runtime] Hello from Foo__Main__Main"); assertHasPrint("[runtime] Hello from Main"); - #end // Disabled this check because types move around a bit so we get false negatives // Kept for debugging purposes @@ -67,6 +65,7 @@ class CsSafeTypeBuilding extends TestCase { function assertBuilt(modules:Array, ?macroInvalidated:Bool = false) { #if debug trace('Invalidated ${modules.join(",")} (macro invalidated: ${macroInvalidated ? "true" : "false"})'); #end + #if debug var assertHasPrint = _assertHasPrint; #end for (m in modules) { assertHasPrint('Building $m.'); @@ -98,6 +97,7 @@ class CsSafeTypeBuilding extends TestCase { runHaxe(args); if (target == "js") originalContent = sys.io.File.getContent(haxe.io.Path.join([testDir, "out.js"])); + assertBuilt(["Main", "Bar", "Baz"], true); assertResult(target); #if debug trace("Rerun without invalidate"); #end