Skip to content

Commit

Permalink
Add test for a non-csv scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
SasinduDilshara committed Aug 12, 2024
1 parent 563d7e8 commit b02b9fb
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,4 +256,14 @@ public void testIgnoredCustomHeaderOptions() {
Assert.assertEquals(errorDiagnosticsList.get(11).diagnosticInfo()
.messageFormat(), IGNORE_OUTPUT_HEADERS_FOR_RECORD_ARRAY);
}

@Test
public void testNonCsvFunctionCall() {
DiagnosticResult diagnosticResult =
CompilerPluginTestUtils.loadPackage("sample_package_11").getCompilation().diagnosticResult();
List<Diagnostic> errorDiagnosticsList = diagnosticResult.diagnostics().stream()
.filter(r -> r.diagnosticInfo().severity().equals(DiagnosticSeverity.ERROR))
.collect(Collectors.toList());
Assert.assertEquals(errorDiagnosticsList.size(), 0);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[package]
org = "wso2"
name = "sample_package_11"
version = "0.1.0"
distribution = "2201.9.2"

[build-options]
observabilityIncluded = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import ballerina/data.csv;

type A record {
int:Unsigned32 headerRows = 0;
string[] customHeaders = [];
boolean outputWithHeaders = false;
};

public function main() returns error? {
record {}[] a = check csv:parseString(string `a,b`, {});
record {}[] b = test({headerRows: 2, outputWithHeaders: false});
}

function test(A a) returns record{}[] {
return [{}];
}

0 comments on commit b02b9fb

Please sign in to comment.