use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class StructNegativeTest method testGetNonInitLastField.
@Test(description = "Test accessing the field of a noninitialized struct", expectedExceptions = { BLangRuntimeException.class }, expectedExceptionsMessageRegExp = ".*error:.*array index out of range.*")
public void testGetNonInitLastField() {
CompileResult compileResult = BCompileUtil.compile("test-src/structs/struct.bal");
Assert.assertEquals(compileResult.getWarnCount(), 0);
Assert.assertEquals(compileResult.getErrorCount(), 0);
BRunUtil.invoke(compileResult, "testGetNonInitLastAttribute");
}
use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class StructNegativeTest method testSetNonInitField.
@Test(description = "Test setting an field of a noninitialized child struct")
public void testSetNonInitField() {
CompileResult compileResult = BCompileUtil.compile("test-src/structs/struct.bal");
Assert.assertEquals(compileResult.getWarnCount(), 0);
Assert.assertEquals(compileResult.getErrorCount(), 0);
BRunUtil.invoke(compileResult, "testSetFieldOfNonInitChildStruct");
}
use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class StructNegativeTest method testGetNonInitArrayField.
@Test(description = "Test accessing an arrays field of a noninitialized struct", expectedExceptions = { BLangRuntimeException.class }, expectedExceptionsMessageRegExp = ".*error:.*array index out of range.*")
public void testGetNonInitArrayField() {
CompileResult compileResult = BCompileUtil.compile("test-src/structs/struct.bal");
Assert.assertEquals(compileResult.getWarnCount(), 0);
Assert.assertEquals(compileResult.getErrorCount(), 0);
BRunUtil.invoke(compileResult, "testGetNonInitArrayAttribute");
}
use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class StructNegativeTest method testSetNonInitLastField.
@Test(description = "Test setting the field of a noninitialized root struct")
public void testSetNonInitLastField() {
CompileResult compileResult = BCompileUtil.compile("test-src/structs/struct.bal");
Assert.assertEquals(compileResult.getWarnCount(), 0);
Assert.assertEquals(compileResult.getErrorCount(), 0);
BRunUtil.invoke(compileResult, "testSetFieldOfNonInitStruct");
}
use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class TypeCastExprTest method testCastToStructInDifferentPkg.
@Test(description = "Test casting a struct to another struct in a different package", enabled = false)
public void testCastToStructInDifferentPkg() {
CompileResult res = BCompileUtil.compile(this, "test-src", "expressions.typecast.foo");
BValue[] returns = BRunUtil.invoke(res, "testCastToStructInDifferentPkg");
}
Aggregations