Search in sources :

Example 81 with CompileResult

use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.

the class FunctionPointersWithOptionalArgsTest method testFunctionPointersWithNamedArgs.

@Test
public void testFunctionPointersWithNamedArgs() {
    CompileResult result = BCompileUtil.compile("test-src/expressions/lambda/function-pointers-with-named-args-negative.bal");
    BAssertUtil.validateError(result, 0, "invalid token 'c'", 6, 29);
}
Also used : CompileResult(org.ballerinalang.launcher.util.CompileResult) Test(org.testng.annotations.Test)

Example 82 with CompileResult

use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.

the class ForkJoinInFunctionTest method testForkJoinAllOfSpecific.

@Test(description = "Test Fork Join All of specific")
public void testForkJoinAllOfSpecific() {
    CompileResult result = BCompileUtil.compile("test-src/workers/fork-join-all-specific.bal");
    BValue[] args = {};
    BValue[] returns = BRunUtil.invoke(result, "testForkJoinAllOfSpecific", args);
    Assert.assertEquals(returns.length, 1);
    Assert.assertTrue(returns[0] instanceof BStringArray);
    Assert.assertEquals(((BStringArray) returns[0]).size(), 2);
}
Also used : BValue(org.ballerinalang.model.values.BValue) CompileResult(org.ballerinalang.launcher.util.CompileResult) BStringArray(org.ballerinalang.model.values.BStringArray) Test(org.testng.annotations.Test)

Example 83 with CompileResult

use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.

the class ForkJoinInFunctionTest method testForkJoinWithWorkersInSameFunction.

@Test(description = "Test Fork Join With Workers in same function")
public void testForkJoinWithWorkersInSameFunction() {
    CompileResult result = BCompileUtil.compile("test-src/workers/fork-join-and-workers-under-same-funtion.bal");
    Assert.assertEquals(result.getErrorCount(), 0);
}
Also used : CompileResult(org.ballerinalang.launcher.util.CompileResult) Test(org.testng.annotations.Test)

Example 84 with CompileResult

use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.

the class ForkJoinInFunctionTest method testForkJoinAll.

@Test(description = "Test Fork Join All")
public void testForkJoinAll() {
    CompileResult result = BCompileUtil.compile("test-src/workers/fork-join-in-all.bal");
    BValue[] args = {};
    BValue[] returns = BRunUtil.invoke(result, "testForkJoinAll", args);
    Assert.assertEquals(returns.length, 1);
    Assert.assertTrue(returns[0] instanceof BIntArray);
    Assert.assertEquals(((BIntArray) returns[0]).size(), 2);
    Assert.assertEquals(((BIntArray) returns[0]).get(0), 234);
    Assert.assertEquals(((BIntArray) returns[0]).get(1), 500);
}
Also used : BValue(org.ballerinalang.model.values.BValue) CompileResult(org.ballerinalang.launcher.util.CompileResult) BIntArray(org.ballerinalang.model.values.BIntArray) Test(org.testng.annotations.Test)

Example 85 with CompileResult

use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.

the class PackageInitWorkerTest method testPackageInitWorkerTest.

@Test
public void testPackageInitWorkerTest() {
    CompileResult result = BCompileUtil.compile("test-src/workers/package-init-worker.bal");
    BValue[] vals = BRunUtil.invoke(result, "test", new BValue[0]);
    Assert.assertEquals(vals.length, 1);
    Assert.assertEquals(((BInteger) vals[0]).intValue(), 1);
}
Also used : BValue(org.ballerinalang.model.values.BValue) CompileResult(org.ballerinalang.launcher.util.CompileResult) Test(org.testng.annotations.Test)

Aggregations

CompileResult (org.ballerinalang.launcher.util.CompileResult)291 Test (org.testng.annotations.Test)287 BValue (org.ballerinalang.model.values.BValue)60 PackageNode (org.ballerinalang.model.tree.PackageNode)16 BLangDocumentation (org.wso2.ballerinalang.compiler.tree.BLangDocumentation)14 BString (org.ballerinalang.model.values.BString)13 BInteger (org.ballerinalang.model.values.BInteger)12 Path (java.nio.file.Path)5 BLangVariable (org.wso2.ballerinalang.compiler.tree.BLangVariable)5 File (java.io.File)4 GrpcCmd (org.ballerinalang.protobuf.cmd.GrpcCmd)4 BStringArray (org.ballerinalang.model.values.BStringArray)3 BLangDeprecatedNode (org.wso2.ballerinalang.compiler.tree.BLangDeprecatedNode)3 BLangFunction (org.wso2.ballerinalang.compiler.tree.BLangFunction)3 BLangStruct (org.wso2.ballerinalang.compiler.tree.BLangStruct)3 BFloat (org.ballerinalang.model.values.BFloat)2 BIntArray (org.ballerinalang.model.values.BIntArray)2 BMap (org.ballerinalang.model.values.BMap)2 BeforeTest (org.testng.annotations.BeforeTest)2 BLangService (org.wso2.ballerinalang.compiler.tree.BLangService)2