Skip to content

Commit

Permalink
Add (failing) test to ensure that widening also works when nested in …
Browse files Browse the repository at this point in the history
…other calls
  • Loading branch information
kindlich committed Jun 22, 2024
1 parent dcc2a0b commit 4c781c7
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,19 @@ public void additionWorksWithDifferentTypes(String typeLeft, String typeRight) {
logger.assertPrintOutput(0, isResultFloatingPoint(typeLeft, typeRight) ? "42.0" : "42");
}

// Ensure that widening also works when nested in other calls
@ParameterizedTest
@MethodSource("numberTypes")
public void additionWorksWithDifferentTypes_withCastingToString(String typeLeft, String typeRight) {
ScriptBuilder.create()
.add("var left = 13 as " + typeLeft + ";")
.add("var right = 29 as " + typeRight + ";")
.add("println(left + right);")
.execute(this);

logger.assertPrintOutput(0, isResultFloatingPoint(typeLeft, typeRight) ? "42.0" : "42");
}

@ParameterizedTest
@MethodSource("numberTypes")
public void subtractionWorksWithDifferentTypes(String typeLeft, String typeRight) {
Expand Down

0 comments on commit 4c781c7

Please sign in to comment.