use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class MapInitializerExprTest method testMapInitWithPackageVars.
@Test(enabled = false)
public void testMapInitWithPackageVars() {
CompileResult result = BCompileUtil.compile(this, "test-src/types/map/", "a.b");
BValue[] returns = BRunUtil.invoke(result, "testMapInitWithPackageVars");
Assert.assertEquals(returns.length, 1);
Assert.assertSame(returns[0].getClass(), BMap.class);
BMap<String, ?> mapValue = (BMap<String, BString>) returns[0];
Assert.assertEquals(mapValue.size(), 2);
Assert.assertEquals(mapValue.get("name").stringValue(), "PI");
Assert.assertEquals(((BFloat) mapValue.get("value")).floatValue(), 3.14159);
}
use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class VarDeclaredAssignmentStmtTest method testVarDeclarationWithDuplicateVariableRefs.
@Test
public void testVarDeclarationWithDuplicateVariableRefs() {
CompileResult res = BCompileUtil.compile("test-src/types/var/var-duplicate-variable-ref-lhs-negative.bal");
Assert.assertEquals(res.getErrorCount(), 1);
BAssertUtil.validateError(res, 0, "redeclared symbol 'age'", 2, 15);
}
use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class VarDeclaredAssignmentStmtTest method testVarDeclarationWithAllDeclaredSymbols.
@Test
public void testVarDeclarationWithAllDeclaredSymbols() {
CompileResult res = BCompileUtil.compile("test-src/types/var/var-declared-symbols-negative.bal");
Assert.assertEquals(res.getErrorCount(), 1);
BAssertUtil.validateError(res, 0, "no new variables on left side", 4, 5);
}
use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class VarDeclaredAssignmentStmtTest method testVarTypeInServiceLevelVariableDefStatement.
@Test
public void testVarTypeInServiceLevelVariableDefStatement() {
// var type is not not allowed in service level variable def statements
CompileResult res = BCompileUtil.compile("test-src/types/var/service-level-variable-def-with-var-negative.bal");
BAssertUtil.validateError(res, 0, "extraneous input 'var'", 9, 5);
}
use of org.ballerinalang.launcher.util.CompileResult in project ballerina by ballerina-lang.
the class XMLLiteralTest method testCombinedExpressionsAsElementName.
@Test
public void testCombinedExpressionsAsElementName() {
CompileResult negativeResult = BCompileUtil.compile("test-src/types/xml/xml-invalid-syntax-1.bal");
Assert.assertEquals(negativeResult.getErrorCount(), 1);
BAssertUtil.validateError(negativeResult, 0, "invalid token '{{'", 3, 24);
}
Aggregations