Browse Source

avoid random trace in unit tests

Simon Krajewski 6 days ago
parent
commit
dbd380fa38
1 changed files with 4 additions and 1 deletions
  1. 4 1
      tests/unit/src/unit/TestNullCoalescing.hx

+ 4 - 1
tests/unit/src/unit/TestNullCoalescing.hx

@@ -88,9 +88,11 @@ private abstract NullCoalAbstractResolve(NullCoalAbstractData) {
 	}
 	}
 }
 }
 
 
+var screamOutput:String = null;
+
 abstract Message(String) from String {
 abstract Message(String) from String {
 	public function scream()
 	public function scream()
-		trace(this.toUpperCase());
+		screamOutput = this.toUpperCase();
 }
 }
 
 
 @:nullSafety(StrictThreaded)
 @:nullSafety(StrictThreaded)
@@ -338,6 +340,7 @@ class TestNullCoalescing extends Test {
 
 
 		var m:Message = "foo";
 		var m:Message = "foo";
 		(m ??= "bar").scream();
 		(m ??= "bar").scream();
+		eq("FOO", screamOutput);
 		eq("unit.Message", HelperMacros.typeString(m ??= "bar"));
 		eq("unit.Message", HelperMacros.typeString(m ??= "bar"));
 		eq("foo", '$m');
 		eq("foo", '$m');