use of org.wso2.ballerinalang.compiler.tree.BLangPackage in project ballerina by ballerina-lang.
the class HtmlDocTest method testGlobalVariablePropertiesExtracted.
@Test(description = "Global variables should be available via construct")
public void testGlobalVariablePropertiesExtracted() throws Exception {
BLangPackage bLangPackage = createPackage("package x.y; " + "@Description { value:\"The Read Append access mode\"}\n" + "public const string RA = \"RA\";");
GlobalVariableDoc globalVariableDoc = Generator.createDocForNode(bLangPackage.getGlobalVariables().get(0));
Assert.assertEquals(globalVariableDoc.name, "RA", "Global variable name should be extracted");
Assert.assertEquals(globalVariableDoc.dataType, "string", "Global variable type should be extracted");
Assert.assertEquals(globalVariableDoc.description, "The Read Append access mode", "Description of the " + "global variable should be extracted");
}
use of org.wso2.ballerinalang.compiler.tree.BLangPackage in project ballerina by ballerina-lang.
the class HtmlDocTest method testStructPropertiesExtracted.
@Test(description = "Struct properties should be available via construct")
public void testStructPropertiesExtracted() throws Exception {
BLangPackage bLangPackage = createPackage("package x.y; " + "@Description { value:\"Message sent by the client\"}" + "@Field {value:\"count: Number of retries\"}\n" + "@Field {value:\"interval: Retry interval in millisecond\"}" + "struct Message {int interval;int count;}");
StructDoc structDoc = Generator.createDocForNode(bLangPackage.getStructs().get(0));
Assert.assertEquals(structDoc.name, "Message", "Struct name should be extracted");
Assert.assertEquals(structDoc.description, "Message sent by the client", "Description of the " + "struct should be extracted");
// Struct fields
Assert.assertEquals(structDoc.fields.get(0).name, "interval", "Struct field name should be extracted");
Assert.assertEquals(structDoc.fields.get(0).dataType, "int", "Struct field type should be extracted");
Assert.assertEquals(structDoc.fields.get(0).description, "Retry interval in millisecond", "Description of the struct field should be extracted");
}
use of org.wso2.ballerinalang.compiler.tree.BLangPackage in project ballerina by ballerina-lang.
the class HtmlDocTest method testAnnotations.
@Test(description = "Annotation in a package should be shown in the constructs")
public void testAnnotations() throws Exception {
BLangPackage bLangPackage = createPackage("package x.y; " + "public annotation ParameterInfo;" + "public annotation ReturnInfo;");
Page page = generatePage(bLangPackage);
Assert.assertEquals(page.constructs.size(), 2);
Assert.assertEquals(page.constructs.get(0).name, "ParameterInfo");
Assert.assertEquals(page.constructs.get(1).name, "ReturnInfo");
}
use of org.wso2.ballerinalang.compiler.tree.BLangPackage in project ballerina by ballerina-lang.
the class HtmlDocTest method testFunctionsWithWithoutStructBindings.
@Test(description = "Functions with struct bindings in a package should be grouped together and functions" + "without struct bindings should be isolated as shown in the constructs")
public void testFunctionsWithWithoutStructBindings() throws Exception {
BLangPackage bLangPackage = createPackage("package x.y; " + "public function <Message m>hello(){} " + "public struct Message { string message; int id;} " + "public function sayBye(){}");
Page page = generatePage(bLangPackage);
Assert.assertEquals(page.constructs.size(), 2);
Assert.assertEquals(page.constructs.get(0).name, "Message");
Assert.assertEquals(page.constructs.get(0).children.get(0).name, "hello");
Assert.assertEquals(page.constructs.get(1).name, "sayBye");
}
use of org.wso2.ballerinalang.compiler.tree.BLangPackage in project ballerina by ballerina-lang.
the class HtmlDocTest method testEmptyPackage.
@Test(description = "Empty package should give an empty page")
public void testEmptyPackage() throws Exception {
BLangPackage bLangPackage = createPackage("package x.y;");
Page page = generatePage(bLangPackage);
Assert.assertTrue(page.constructs.isEmpty());
}
Aggregations