Skip to content

Commit

Permalink
Add missing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredlll08 authored and kindlich committed May 28, 2024
1 parent 5f9995f commit b1c4b3b
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,30 @@ public void callback() {
logger.assertPrintOutput(0, "4");
}

@Test
public void projection() {
ScriptBuilder.create()
.add("var x = [9, 8, 7] as int[];")
.add("var y = new int[]<int>(x, (xVal => 10 * xVal) as function(xVal as int) as int);")
.add("println(y[0]);")
.execute(this);

logger.assertPrintOutputSize(1);
logger.assertPrintOutput(0, "90");
}

@Test
public void projectionWithIndex() {
ScriptBuilder.create()
.add("var x = [9, 8, 7] as int[];")
.add("var y = new int[]<int>(x, ((index, xVal) => 10 * xVal) as function(index as usize, xVal as int) as int);")
.add("println(y[0]);")
.execute(this);

logger.assertPrintOutputSize(1);
logger.assertPrintOutput(0, "90");
}

@Test
public void varargCreationShouldUseProperType() {
ScriptBuilder.create()
Expand Down

0 comments on commit b1c4b3b

Please sign in to comment.