Search in sources :

Example 26 with CompileResult

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

the class StructWithPrivateFieldsNegativeTest method testPrivateStructAccess2.

@Test(description = "Test private struct access in public functions")
public void testPrivateStructAccess2() {
    CompileResult compileResult = BCompileUtil.compile(this, "test-src/structs", "private-field2");
    Assert.assertEquals(compileResult.getErrorCount(), 4);
    String expectedErrMsg = "attempt to refer to non-public symbol ";
    BAssertUtil.validateError(compileResult, 0, expectedErrMsg + "'address'", 15, 13);
    BAssertUtil.validateError(compileResult, 2, expectedErrMsg + "'FooFamily'", 5, 13);
    BAssertUtil.validateError(compileResult, 3, expectedErrMsg + "'FooFamily'", 10, 13);
}
Also used : CompileResult(org.ballerinalang.launcher.util.CompileResult) Test(org.testng.annotations.Test)

Example 27 with CompileResult

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

the class StructWithPrivateFieldsNegativeTest method testPrivateFieldAccess.

@Test(description = "Test private field access")
public void testPrivateFieldAccess() {
    CompileResult compileResult = BCompileUtil.compile("test-src/structs/struct-private-fields-02-negative.bal");
    BAssertUtil.validateError(compileResult, 0, "attempt to refer to non-public symbol 'ssn'", 9, 18);
    BAssertUtil.validateError(compileResult, 1, "undefined field 'ssn' in struct 'org.foo:person'", 9, 18);
}
Also used : CompileResult(org.ballerinalang.launcher.util.CompileResult) Test(org.testng.annotations.Test)

Example 28 with CompileResult

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

the class AnnotationTest method testSensitiveNegative.

@Test
public void testSensitiveNegative() {
    CompileResult result = BCompileUtil.compile("test-src/taintchecking/annotations/sensitive-negative.bal");
    Assert.assertTrue(result.getDiagnostics().length == 2);
    BAssertUtil.validateError(result, 0, "tainted value passed to sensitive parameter 'secureIn'", 2, 39);
    BAssertUtil.validateError(result, 1, "tainted value passed to sensitive parameter 'secureIn'", 3, 50);
}
Also used : CompileResult(org.ballerinalang.launcher.util.CompileResult) Test(org.testng.annotations.Test)

Example 29 with CompileResult

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

the class AnnotationTest method testSensitiveRestArgs.

@Test
public void testSensitiveRestArgs() {
    CompileResult result = BCompileUtil.compile("test-src/taintchecking/annotations/sensitive-rest-args.bal");
    Assert.assertTrue(result.getDiagnostics().length == 0);
}
Also used : CompileResult(org.ballerinalang.launcher.util.CompileResult) Test(org.testng.annotations.Test)

Example 30 with CompileResult

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

the class AnnotationTest method testSensitiveDefaultArgs.

@Test
public void testSensitiveDefaultArgs() {
    CompileResult result = BCompileUtil.compile("test-src/taintchecking/annotations/sensitive-default-args.bal");
    Assert.assertTrue(result.getDiagnostics().length == 0);
}
Also used : 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