use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class FunctionSignatureNegativeTest method testFuncWithTwoRestParams.
@Test
public void testFuncWithTwoRestParams() {
CompileResult result = BCompileUtil.compile("test-src/functions/function-with-two-rest-params.bal");
BAssertUtil.validateError(result, 0, "mismatched input ','. expecting ')'", 1, 52);
}
use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class LaunchTest method testRunPackageWithFileSeparater.
// @Test
// public void testRunEmptyPackage() {
// CompileResult result = BCompileUtil.compile(this, "test-src/launch/", "foo");
// Assert.assertEquals(result.getErrorCount(), 0);
// Assert.assertNull(result.getProgFile());
// }
@Test
public void testRunPackageWithFileSeparater() {
CompileResult compileResult = BCompileUtil.compile(this, "test-src/launch/", "foo.bar");
Assert.assertEquals(compileResult.getErrorCount(), 0);
BValue[] result = BRunUtil.invoke(compileResult, "foo");
Assert.assertEquals(result[0].stringValue(), "hello!");
}
use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class LaunchTest method testRunNonExistingPackage.
@Test(expectedExceptions = { BLangCompilerException.class }, expectedExceptionsMessageRegExp = "cannot find package 'xxxx'")
public void testRunNonExistingPackage() {
CompileResult result = BCompileUtil.compile(this, "test-src/launch/", "xxxx");
Assert.assertEquals(result.getErrorCount(), 0);
Assert.assertNull(result.getProgFile());
}
use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class LocksInMainTest method testThrowErrorInsideTryCatchFinallyInsideLock.
@Test(description = "Tests throwing an error inside try catch finally block inside a lock")
public void testThrowErrorInsideTryCatchFinallyInsideLock() {
CompileResult compileResult = BCompileUtil.compile("test-src/lock/locks-in-functions.bal");
BValue[] returns = BRunUtil.invoke(compileResult, "throwErrorInsideTryCatchFinallyInsideLock");
assertEquals(returns.length, 2);
assertSame(returns[0].getClass(), BInteger.class);
assertSame(returns[1].getClass(), BString.class);
assertEquals(((BInteger) returns[0]).intValue(), 53);
assertEquals(returns[1].stringValue(), "worker 2 sets the string after try catch finally inside lock");
}
use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class LocksInMainTest method testLockWithinLockInWorkersForBlobAndBoolean.
@Test(description = "Tests lock within lock in workers for boolean and blob")
public void testLockWithinLockInWorkersForBlobAndBoolean() {
CompileResult compileResult = BCompileUtil.compile("test-src/lock/locks-in-functions.bal");
BValue[] returns = BRunUtil.invoke(compileResult, "lockWithinLockInWorkersForBlobAndBoolean");
assertEquals(returns.length, 2);
assertSame(returns[0].getClass(), BBoolean.class);
assertSame(returns[1].getClass(), BBlob.class);
assertEquals(((BBoolean) returns[0]).booleanValue(), true);
assertEquals(returns[1].stringValue(), "sample blob output");
}
Aggregations