Skip to content

Commit

Permalink
Update testerina-tests for new diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
RadCod3 committed Mar 5, 2024
1 parent 53d30d3 commit d20fec1
Show file tree
Hide file tree
Showing 133 changed files with 1,156 additions and 239 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ public static Ansi renderDiagnostic(Diagnostic diagnostic, Document document, in
boolean colorEnabled) {

String diagnosticCode = diagnostic.diagnosticInfo().code();
if (diagnostic instanceof PackageDiagnostic && diagnosticCode.startsWith(COMPILER_ERROR_PREFIX)) {
if (diagnostic instanceof PackageDiagnostic && diagnosticCode != null &&
diagnosticCode.startsWith(COMPILER_ERROR_PREFIX)) {
int diagnosticCodeNumber = Integer.parseInt(diagnosticCode.substring(3));
if (diagnosticCodeNumber < SYNTAX_ERROR_CODE_THRESHOLD) {
PackageDiagnostic packageDiagnostic = (PackageDiagnostic) diagnostic;
Expand Down Expand Up @@ -85,10 +86,11 @@ private static String diagnosticToString(Diagnostic diagnostic, boolean colorEna
String color = SEVERITY_COLORS.get(severity);
String message = diagnostic.toString().substring(severityString.length());
String code = diagnostic.diagnosticInfo().code();
boolean isMultiline = diagnostic.message().contains("\n");
String formatString = getColoredString("%s", color, colorEnabled) + "%s" + (isMultiline ? "\n(%s)" : " (%s)");
boolean isMultiline = diagnostic.message().contains(NEW_LINE);
String formatString = getColoredString("%s", color, colorEnabled) + "%s" +
(code != null ? (isMultiline ? NEW_LINE + "(%s)" : " (%s)") : "");

return String.format(formatString, severityString, message, code);
return String.format(formatString, severityString, message, code != null ? code : "");
}

private static DiagnosticAnnotation getDiagnosticLineFromSyntaxAPI(Document document, Location location,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Compiling source
intg_tests/annotation_access:0.0.0
HINT [tests/main_test.bal:(73:5,73:5)] concurrent calls will not be made to this method since the service is not an 'isolated' service
HINT [tests/main_test.bal:(73:5,73:5)] concurrent calls will not be made to this method since the service is not an 'isolated' service (BCH2004)
|
73 | remote function xyz() {
| ^

ballerina: Oh no, something really went wrong. Bad. Sad.

We appreciate it if you can report the code that broke Ballerina in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
Compiling source
intg_tests/assertions:0.0.0
WARNING [tests/assert-test-behavioral-types.bal:(22:5,22:29)] undocumented field 'name'
WARNING [tests/assert-test-behavioral-types.bal:(23:5,23:24)] undocumented field 'age'
WARNING [tests/assert-test-behavioral-types.bal:(24:5,24:32)] undocumented field 'parent'
WARNING [tests/assert-test-behavioral-types.bal:(22:5,22:29)] undocumented field 'name' (BCE20004)
|
22 | public string name = "";
| ^^^^^^^^^^^^^^^^^^^^^^^^

WARNING [tests/assert-test-behavioral-types.bal:(23:5,23:24)] undocumented field 'age' (BCE20004)
|
23 | public int age = 0;
| ^^^^^^^^^^^^^^^^^^^

WARNING [tests/assert-test-behavioral-types.bal:(24:5,24:32)] undocumented field 'parent' (BCE20004)
|
24 | public Person? parent = ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
Compiling source
intg_tests/assertions:0.0.0
WARNING [tests/assertions-diff-error-messages.bal:(22:5,22:29)] undocumented field 'name'
WARNING [tests/assertions-diff-error-messages.bal:(23:5,23:24)] undocumented field 'age'
WARNING [tests/assertions-diff-error-messages.bal:(24:5,24:32)] undocumented field 'parent'
WARNING [tests/assertions-diff-error-messages.bal:(22:5,22:29)] undocumented field 'name' (BCE20004)
|
22 | public string name = "";
| ^^^^^^^^^^^^^^^^^^^^^^^^

WARNING [tests/assertions-diff-error-messages.bal:(23:5,23:24)] undocumented field 'age' (BCE20004)
|
23 | public int age = 0;
| ^^^^^^^^^^^^^^^^^^^

WARNING [tests/assertions-diff-error-messages.bal:(24:5,24:32)] undocumented field 'parent' (BCE20004)
|
24 | public Person? parent = ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
Compiling source
intg_tests/assertions:0.0.0
WARNING [tests/assert-test-structural-types.bal:(22:5,22:21)] undocumented field 'id'
WARNING [tests/assert-test-structural-types.bal:(23:5,23:17)] undocumented field 'name'
WARNING [tests/assert-test-structural-types.bal:(24:5,24:18)] undocumented field 'salary'
WARNING [tests/assert-test-structural-types.bal:(22:5,22:21)] undocumented field 'id' (BCE20004)
|
22 | readonly int id;
| ^^^^^^^^^^^^^^^^

WARNING [tests/assert-test-structural-types.bal:(23:5,23:17)] undocumented field 'name' (BCE20004)
|
23 | string name;
| ^^^^^^^^^^^^

WARNING [tests/assert-test-structural-types.bal:(24:5,24:18)] undocumented field 'salary' (BCE20004)
|
24 | float salary;
| ^^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
Compiling source
intg_tests/assertions:0.0.0
WARNING [tests/assertions-error-messages.bal:(22:5,22:29)] undocumented field 'name'
WARNING [tests/assertions-error-messages.bal:(23:5,23:24)] undocumented field 'age'
WARNING [tests/assertions-error-messages.bal:(24:5,24:32)] undocumented field 'parent'
WARNING [tests/assertions-error-messages.bal:(22:5,22:29)] undocumented field 'name' (BCE20004)
|
22 | public string name = "";
| ^^^^^^^^^^^^^^^^^^^^^^^^

WARNING [tests/assertions-error-messages.bal:(23:5,23:24)] undocumented field 'age' (BCE20004)
|
23 | public int age = 0;
| ^^^^^^^^^^^^^^^^^^^

WARNING [tests/assertions-error-messages.bal:(24:5,24:32)] undocumented field 'parent' (BCE20004)
|
24 | public Person? parent = ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
Compiling source
intg_tests/dataproviders:0.0.0
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a'
WARNING [tests/new-data-provider-tests.bal:(121:9,121:21)] unused variable 'a' (BCE20403)
|
121 | int a = 9/0;
| ^^^^^^^^^^^^

WARNING [tests/new-data-provider-tests.bal:(153:9,153:21)] unused variable 'a' (BCE20403)
|
153 | int a = 9/0;
| ^^^^^^^^^^^^


Running Tests with Coverage

Expand Down
Loading

0 comments on commit d20fec1

Please sign in to comment.