use of org.ballerinalang.natives.NativeElementRepository in project ballerina by ballerina-lang.
the class FunctionSignatureTest method testOptionalArgsInNativeFunc.
@Test(enabled = false)
public void testOptionalArgsInNativeFunc() {
NativeElementRepository repo = NativeUnitLoader.getInstance().getNativeElementRepository();
StandardNativeElementProvider provider = new StandardNativeElementProvider();
provider.populateNatives(repo);
CompileResult result = BCompileUtil.compile(this, "test-src/functions/", "foo.bar");
BValue[] returns = BRunUtil.invoke(result, "testOptionalArgsInNativeFunc");
Assert.assertTrue(returns[0] instanceof BInteger);
Assert.assertEquals(((BInteger) returns[0]).intValue(), 78);
Assert.assertTrue(returns[1] instanceof BFloat);
Assert.assertEquals(((BFloat) returns[1]).floatValue(), 89.0);
Assert.assertTrue(returns[2] instanceof BString);
Assert.assertEquals(returns[2].stringValue(), "John");
Assert.assertTrue(returns[3] instanceof BInteger);
Assert.assertEquals(((BInteger) returns[3]).intValue(), 5);
Assert.assertTrue(returns[4] instanceof BString);
Assert.assertEquals(returns[4].stringValue(), "Doe");
Assert.assertTrue(returns[5] instanceof BIntArray);
Assert.assertEquals(returns[5].stringValue(), "[4, 5, 6]");
}
Aggregations