diff --git a/cli/ballerina-cli/build.gradle b/cli/ballerina-cli/build.gradle index 90b35005a054..90d7a04f2c53 100644 --- a/cli/ballerina-cli/build.gradle +++ b/cli/ballerina-cli/build.gradle @@ -34,6 +34,7 @@ configurations { dependencies { + implementation project(':ballerina-parser') implementation project(':ballerina-lang') implementation project(':ballerina-runtime') implementation project(':ballerina-tools-api') diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/diagnostics/AnnotateDiagnostics.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/diagnostics/AnnotateDiagnostics.java new file mode 100644 index 000000000000..724cafffcec5 --- /dev/null +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/diagnostics/AnnotateDiagnostics.java @@ -0,0 +1,278 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.ballerina.cli.diagnostics; + +import io.ballerina.compiler.internal.diagnostics.StringDiagnosticProperty; +import io.ballerina.projects.Document; +import io.ballerina.projects.DocumentId; +import io.ballerina.projects.Module; +import io.ballerina.projects.ModuleName; +import io.ballerina.projects.Package; +import io.ballerina.projects.internal.PackageDiagnostic; +import io.ballerina.tools.diagnostics.Diagnostic; +import io.ballerina.tools.diagnostics.DiagnosticInfo; +import io.ballerina.tools.diagnostics.DiagnosticSeverity; +import io.ballerina.tools.diagnostics.Location; +import io.ballerina.tools.text.LinePosition; +import io.ballerina.tools.text.TextDocument; +import org.jline.jansi.Ansi; +import org.jline.terminal.TerminalBuilder; + +import java.io.IOException; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static io.ballerina.cli.diagnostics.DiagnosticAnnotation.NEW_LINE; +import static io.ballerina.cli.diagnostics.DiagnosticAnnotation.SEVERITY_COLORS; +import static io.ballerina.cli.diagnostics.DiagnosticAnnotation.getColoredString; +import static io.ballerina.cli.utils.OsUtils.isWindows; + +/** + * This class is used to generate diagnostic annotated messages from diagnostics. + * + * @since 2201.10.0 + */ +public final class AnnotateDiagnostics { + + private static final String COMPILER_ERROR_PREFIX = "BCE"; + private static final int SYNTAX_ERROR_CODE_THRESHOLD = 1000; + private static final int MISSING_TOKEN_KEYWORD_CODE_THRESHOLD = 400; + private static final int INVALID_TOKEN_CODE = 600; + private static final int NO_TRUNCATE_WIDTH = 999; + + private final Map documentMap; + private final int terminalWidth; + private final boolean isColorEnabled; + + public AnnotateDiagnostics(Package currentPackage) { + this.documentMap = getDocumentMap(currentPackage); + int terminalWidth = getTerminalWidth(); + this.isColorEnabled = terminalWidth != 0; + this.terminalWidth = terminalWidth == 0 ? NO_TRUNCATE_WIDTH : terminalWidth; + } + + /** + * Returns an annotated diagnostic that is ready to be printed to the console. + * + * @param diagnostic The diagnostic to be annotated. + * @return The annotated diagnostic. + */ + public Ansi renderDiagnostic(Diagnostic diagnostic) { + Location diagnosticLocation = diagnostic.location(); + Document document = documentMap.get(diagnosticLocation.lineRange().fileName()); + if (document == null) { + return renderAnsi(diagnosticToString(diagnostic, isColorEnabled)); + } + + DiagnosticInfo diagnosticInfo = diagnostic.diagnosticInfo(); + String diagnosticCode = diagnosticInfo.code(); + if (diagnostic instanceof PackageDiagnostic packageDiagnostic && diagnosticCode != null && + diagnosticCode.startsWith(COMPILER_ERROR_PREFIX)) { + int diagnosticCodeNumber = getCompilerErrorCodeNumber(diagnosticCode); + if (diagnosticCodeNumber < SYNTAX_ERROR_CODE_THRESHOLD) { + return renderAnsi( + diagnosticToString(diagnostic, isColorEnabled) + NEW_LINE + getSyntaxDiagnosticAnnotation( + document, packageDiagnostic, diagnosticCodeNumber)); + } + } + + DiagnosticAnnotation diagnosticAnnotation = + getDiagnosticAnnotation(document, diagnosticLocation, diagnosticInfo.severity()); + return renderAnsi(diagnosticToString(diagnostic, isColorEnabled) + NEW_LINE + diagnosticAnnotation); + } + + private static int getTerminalWidth() { + try { + return TerminalBuilder.builder().dumb(true).build().getWidth(); + } catch (IOException e) { + return NO_TRUNCATE_WIDTH; + } + } + + private static void processDocuments(Module module, DocumentId documentId, Map documentMap) { + Document document = module.document(documentId); + documentMap.put(getDocumentPath(module.moduleName(), document.name()), document); + } + + /** + * Returns a map of documents in the given package. + * + * @param currentPackage The package to get the documents from. + * @return A map of document paths to documents. + */ + private static Map getDocumentMap(Package currentPackage) { + Map documentMap = new HashMap<>(); + currentPackage.moduleIds().forEach(moduleId -> { + Module module = currentPackage.module(moduleId); + module.documentIds().forEach(documentId -> processDocuments(module, documentId, documentMap)); + module.testDocumentIds().forEach(documentId -> processDocuments(module, documentId, documentMap)); + }); + + return documentMap; + } + + private static String getDocumentPath(ModuleName moduleName, String documentName) { + String documentNameFixed = isWindows() ? documentName.replace("/", "\\") : documentName; + if (moduleName.isDefaultModuleName()) { + return documentNameFixed; + } + return Paths.get("modules", moduleName.moduleNamePart(), documentNameFixed).toString(); + } + + private static int getCompilerErrorCodeNumber(String diagnosticCode) { + return Integer.parseInt(diagnosticCode.substring(COMPILER_ERROR_PREFIX.length())); + } + + private static String diagnosticToString(Diagnostic diagnostic, boolean isColorEnabled) { + DiagnosticInfo diagnosticInfo = diagnostic.diagnosticInfo(); + DiagnosticSeverity severity = diagnosticInfo.severity(); + String severityString = severity.toString(); + String color = SEVERITY_COLORS.get(severity); + String message = diagnostic.toString().substring(severityString.length()); + String code = diagnosticInfo.code(); + boolean isMultiline = diagnostic.message().contains(NEW_LINE); + boolean isCodeNotNull = code != null; + String formatString = getColoredString("%s", color, isColorEnabled) + "%s" + + (isCodeNotNull ? (isMultiline ? NEW_LINE + "(%s)" : " (%s)") : ""); + + return String.format(formatString, severityString, message, isCodeNotNull ? code : ""); + } + + private DiagnosticAnnotation getDiagnosticAnnotation(Document document, Location location, + DiagnosticSeverity severity) { + TextDocument textDocument = document.textDocument(); + LocationDetails locationDetails = getLocationDetails(location); + boolean isMultiline = locationDetails.startLine != locationDetails.endLine; + int length = isMultiline ? textDocument.line(locationDetails.startLine).length() - locationDetails.startOffset : + locationDetails.endOffset - locationDetails.startOffset; + + return new DiagnosticAnnotation( + getLines(textDocument, locationDetails), + locationDetails.startOffset, + length == 0 ? 1 : length, + isMultiline, + locationDetails.endOffset, + locationDetails.startLine, + severity, + DiagnosticAnnotation.DiagnosticAnnotationType.REGULAR, + terminalWidth, isColorEnabled); + } + + private DiagnosticAnnotation getSyntaxDiagnosticAnnotation(Document document, PackageDiagnostic packageDiagnostic, + int diagnosticCode) { + TextDocument textDocument = document.textDocument(); + Location location = packageDiagnostic.location(); + LocationDetails locationDetails = getLocationDetails(location); + String color = SEVERITY_COLORS.get(DiagnosticSeverity.ERROR); + + if (diagnosticCode < MISSING_TOKEN_KEYWORD_CODE_THRESHOLD) { + return getMissingTokenAnnotation(packageDiagnostic, textDocument, locationDetails, color); + } + + if (diagnosticCode == INVALID_TOKEN_CODE) { + return getInvalidTokenAnnotation(textDocument, locationDetails, color); + } + return getDiagnosticAnnotation(document, location, DiagnosticSeverity.ERROR); + } + + private DiagnosticAnnotation getMissingTokenAnnotation(PackageDiagnostic packageDiagnostic, + TextDocument textDocument, LocationDetails locationDetails, + String color) { + StringDiagnosticProperty strProperty = (StringDiagnosticProperty) packageDiagnostic.properties().get(0); + String lineString = textDocument.line(locationDetails.startLine).text(); + StringBuilder lineBuilder = new StringBuilder().append(lineString, 0, locationDetails.startOffset); + StringBuilder missingTokenBuilder = + new StringBuilder(getColoredString(strProperty.value(), color, isColorEnabled)); + int padding = 0; + if (locationDetails.startOffset < lineString.length() && + lineString.charAt(locationDetails.startOffset) != ' ') { + missingTokenBuilder.append(" "); + } + if (locationDetails.startOffset > 0 && lineString.charAt(locationDetails.startOffset - 1) != ' ') { + missingTokenBuilder.insert(0, " "); + padding++; + } + lineBuilder.append(missingTokenBuilder).append(lineString, locationDetails.startOffset, lineString.length()); + List lines = new ArrayList<>(List.of(lineBuilder.toString())); + return new DiagnosticAnnotation( + lines, + padding + locationDetails.startOffset, + strProperty.value().length(), + false, + 0, + locationDetails.startLine, + DiagnosticSeverity.ERROR, + DiagnosticAnnotation.DiagnosticAnnotationType.MISSING, + terminalWidth, isColorEnabled); + } + + private DiagnosticAnnotation getInvalidTokenAnnotation(TextDocument textDocument, LocationDetails locationDetails, + String color) { + List lines = getLines(textDocument, locationDetails); // TODO: Remove reusable code to separate methods + String line = lines.get(0); + String annotatedLine = line.substring(0, locationDetails.startOffset) + + getColoredString(line.substring(locationDetails.startOffset, locationDetails.endOffset), color, + isColorEnabled) + line.substring(locationDetails.endOffset); + lines.set(0, annotatedLine); + return new DiagnosticAnnotation( + lines, + locationDetails.startOffset, + locationDetails.endOffset - locationDetails.startOffset, + false, + 0, + locationDetails.startLine, + DiagnosticSeverity.ERROR, + DiagnosticAnnotation.DiagnosticAnnotationType.INVALID, + terminalWidth, isColorEnabled); + } + + private static List getLines(TextDocument textDocument, LocationDetails locationDetails) { + List lines = new ArrayList<>(); + for (int i = locationDetails.startLine; i <= locationDetails.endLine; i++) { + lines.add(textDocument.line(i).text()); + } + return lines; + } + + private static LocationDetails getLocationDetails(Location location) { + LinePosition startLine = location.lineRange().startLine(); + LinePosition endLine = location.lineRange().endLine(); + return new LocationDetails(startLine.line(), startLine.offset(), endLine.line(), endLine.offset()); + } + + private static Ansi renderAnsi(String message) { + return Ansi.ansi().render(message); + } + + /** + * Represents the location details of a diagnostic. + * + * @param startLine The start line of the diagnostic. + * @param startOffset The start offset of the diagnostic. + * @param endLine The end line of the diagnostic. + * @param endOffset The end offset of the diagnostic. + */ + private record LocationDetails(int startLine, int startOffset, int endLine, int endOffset) { + + } + +} diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/diagnostics/DiagnosticAnnotation.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/diagnostics/DiagnosticAnnotation.java new file mode 100644 index 000000000000..0fc7427b523a --- /dev/null +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/diagnostics/DiagnosticAnnotation.java @@ -0,0 +1,295 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.ballerina.cli.diagnostics; + +import io.ballerina.tools.diagnostics.DiagnosticSeverity; + +import java.util.List; +import java.util.Map; + +/** + * Represents a diagnostic annotation that is used to annotate the source code with diagnostics. + * + * @since 2201.10.0 + */ +public final class DiagnosticAnnotation { + + public static final String NEW_LINE = System.lineSeparator(); + public static final String JANSI_ANNOTATOR = "@|"; + public static final String JANSI_RESET = "|@"; + private static final String PIPE = "|"; + private static final String COLON = ":"; + private static final String ELLIPSIS = "..."; + private static final int PIPE_AND_PADDING_LENGTH = " | ".length(); + private static final int MAX_LINES_BEFORE_HIDING = 3; + private static final String INTERNAL_COLOR = "blue"; + private static final String HINT_COLOR = "green"; + private static final String INFO_COLOR = "blue"; + private static final String WARNING_COLOR = "yellow"; + private static final String ERROR_COLOR = "red"; + public static final Map SEVERITY_COLORS; + + static { + SEVERITY_COLORS = + Map.of(DiagnosticSeverity.INTERNAL, INTERNAL_COLOR, DiagnosticSeverity.HINT, HINT_COLOR, + DiagnosticSeverity.INFO, INFO_COLOR, DiagnosticSeverity.WARNING, WARNING_COLOR, + DiagnosticSeverity.ERROR, ERROR_COLOR); + } + + public enum DiagnosticAnnotationType { + REGULAR, + MISSING, + INVALID + } + + private final List lines; + private final int start; + private final int length; + private final boolean isMultiline; + private final int endOffset; + private final int startLineNumber; + private final int terminalWidth; + private final DiagnosticSeverity severity; + private final DiagnosticAnnotationType type; + private final boolean isColorEnabled; + + public DiagnosticAnnotation(List lines, int start, int length, boolean isMultiline, int endOffset, + int startLineNumber, DiagnosticSeverity severity, DiagnosticAnnotationType type, + int terminalWidth, boolean isColorEnabled) { + this.start = getStart(lines, start); + lines.set(0, replaceTabs(lines.get(0), start)); + this.lines = lines; + this.length = length; + this.endOffset = endOffset; + this.isMultiline = isMultiline; + this.startLineNumber = startLineNumber + 1; + this.severity = severity; + this.type = type; + this.terminalWidth = terminalWidth; + this.isColorEnabled = isColorEnabled; + } + + @Override + public String toString() { + StringBuilder outputBuilder = new StringBuilder(); + if (!isMultiline) { + int digitsNum = (int) Math.log10(startLineNumber) + 1; + String padding = " ".repeat(digitsNum + 1); + int maxLength = terminalWidth - digitsNum - PIPE_AND_PADDING_LENGTH; + TruncateResult result = truncate(lines.get(0), maxLength, start, length); + outputBuilder.append(padding).append(PIPE).append(NEW_LINE) + .append(getLineNumberString(digitsNum, startLineNumber)).append(PIPE).append(" "); + if (result.needsWrap) { + int firstUnderlineLength = Math.min(result.diagnosticLength, maxLength - result.diagnosticStart); + String underlineFirstHalf = getUnderline(result.diagnosticStart, firstUnderlineLength); + String underlineSecondHalf = + getUnderline(0, result.diagnosticLength - maxLength + result.diagnosticStart); + outputBuilder.append(result.line, 0, maxLength).append(NEW_LINE) + .append(padding).append(PIPE).append(" ") + .append(underlineFirstHalf).append(NEW_LINE) + .append(result.line, maxLength, result.line.length()).append(NEW_LINE) + .append(underlineSecondHalf); + } else { + String underline = getUnderline(result.diagnosticStart, result.diagnosticLength); + outputBuilder.append(result.line).append(NEW_LINE) + .append(padding).append(PIPE).append(" ") + .append(underline).append(NEW_LINE); + } + return outputBuilder.toString(); + } + String startLine = lines.get(0); + String endLine = lines.get(lines.size() - 1); + + int maxLineLength = Math.max(startLine.length(), endLine.length()); + int endDigitsNum = (int) Math.log10(startLineNumber + lines.size() - 1) + 1; + String padding = " ".repeat(endDigitsNum + 1); + String paddingWithColon; + if (endDigitsNum == 1) { + paddingWithColon = COLON + " ".repeat(endDigitsNum); + } else { + paddingWithColon = " " + COLON + " ".repeat(endDigitsNum - 1); + } + int tabsInLastLine = countTabChars(endLine, this.endOffset); + endLine = replaceTabs(endLine, this.endOffset); + int maxLength = terminalWidth - endDigitsNum - PIPE_AND_PADDING_LENGTH; + TruncateResult startLineResult = truncate(startLine, maxLength, start, length); + TruncateResult endLineResult = truncate(endLine, maxLength, 0, + endOffset + 3 * tabsInLastLine); + + int firstUnderlineLength = + Math.min(startLineResult.diagnosticLength, maxLength - startLineResult.diagnosticStart); + String underlineFirstHalf = getUnderline(startLineResult.diagnosticStart, firstUnderlineLength); + String underlineSecondHalf = + getUnderline(0, startLineResult.diagnosticLength - maxLength + startLineResult.diagnosticStart); + + outputBuilder.append(padding).append(PIPE).append(NEW_LINE) + .append(getLineNumberString(endDigitsNum, startLineNumber)).append(PIPE).append(" "); + if (startLineResult.needsWrap) { + outputBuilder.append(startLineResult.line, 0, maxLength).append(NEW_LINE); + } else { + outputBuilder.append(startLineResult.line).append(NEW_LINE); + } + + if (lines.size() <= MAX_LINES_BEFORE_HIDING) { + outputBuilder.append(padding).append(PIPE).append(" "); + if (startLineResult.needsWrap) { + outputBuilder.append(underlineFirstHalf).append(NEW_LINE) + .append(startLineResult.line, maxLength, startLineResult.line.length()).append(NEW_LINE) + .append(underlineSecondHalf).append(NEW_LINE); + } else { + outputBuilder + .append(getUnderline(startLineResult.diagnosticStart, startLineResult.diagnosticLength)) + .append(NEW_LINE); + } + for (int i = 1; i < lines.size() - 1; i++) { + String line = replaceTabs(lines.get(i), 0); + TruncateResult lineResult = truncate(line, maxLength, 0, line.length()); + outputBuilder.append(getLineNumberString(endDigitsNum, startLineNumber + i)).append(PIPE).append(" "); + if (lineResult.needsWrap) { + int midFirstUnderlineLength = + Math.min(lineResult.diagnosticLength, maxLength - lineResult.diagnosticStart); + String midUnderlineFirstHalf = getUnderline(lineResult.diagnosticStart, midFirstUnderlineLength); + String midUnderlineSecondHalf = + getUnderline(0, lineResult.diagnosticLength - maxLength + lineResult.diagnosticStart); + outputBuilder.append(lineResult.line, 0, maxLength).append(NEW_LINE) + .append(padding).append(PIPE).append(" ") + .append(midUnderlineFirstHalf).append(NEW_LINE) + .append(lineResult.line, maxLength, lineResult.line.length()).append(NEW_LINE) + .append(midUnderlineSecondHalf).append(NEW_LINE); + + } else { + outputBuilder.append(lineResult.line).append(NEW_LINE) + .append(padding).append(PIPE).append(" ") + .append(getUnderline(lineResult.diagnosticStart, lineResult.diagnosticLength)) + .append(NEW_LINE); + } + } + + } else { + String paddingToMiddleColon = " ".repeat(Math.min(terminalWidth, maxLineLength) / 2); + String hiddenLinesPlaceholder = paddingWithColon + PIPE + " " + paddingToMiddleColon + COLON + NEW_LINE; + outputBuilder.append(paddingWithColon).append(PIPE).append(" "); + if (startLineResult.needsWrap) { + outputBuilder.append(underlineFirstHalf).append(NEW_LINE) + .append(startLineResult.line, maxLength, startLineResult.line.length()).append(NEW_LINE) + .append(underlineSecondHalf).append(NEW_LINE); + } else { + outputBuilder + .append(getUnderline(startLineResult.diagnosticStart, startLineResult.diagnosticLength)) + .append(NEW_LINE) + .append(hiddenLinesPlaceholder).append(hiddenLinesPlaceholder); + } + + } + return outputBuilder.append(getLineNumberString(endDigitsNum, startLineNumber + lines.size() - 1)) + .append(PIPE).append(" ").append(endLineResult.line).append(NEW_LINE) + .append(padding).append(PIPE).append(" ") + .append(getUnderline(0, endLineResult.diagnosticLength)) + .append(NEW_LINE).toString(); + } + + public static String getColoredString(String message, String color, boolean isColorEnabled) { + return isColorEnabled ? JANSI_ANNOTATOR + color + " " + message + JANSI_RESET : message; + } + + private static String getLineNumberString(int numberOfDigits, int lineNumber) { + return String.format("%" + numberOfDigits + "d ", lineNumber); + } + + private static int getStart(List lines, int start) { + return start + 3 * countTabChars(lines.get(0), start); + } + + private String getUnderline(int offset, int length) { + if (length <= 0) { + return ""; + } + String symbol = "^"; + if (this.type == DiagnosticAnnotationType.MISSING) { + symbol = "+"; + } + return " ".repeat(offset) + + getColoredString(symbol.repeat(length), SEVERITY_COLORS.get(this.severity), this.isColorEnabled); + } + + private static int countTabChars(String line, int end) { + int count = 0; + for (int i = 0; i < end; i++) { + if (line.charAt(i) == '\t') { + count++; + } + } + return count; + } + + protected static TruncateResult truncate(String line, int maxLength, int diagnosticStart, int diagnosticLength) { + if (line.length() <= maxLength) { + return new TruncateResult(line, diagnosticStart, diagnosticLength, false); + } + + StringBuilder truncatedLineBuilder = new StringBuilder(); + if (diagnosticStart + diagnosticLength <= maxLength - ELLIPSIS.length()) { + truncatedLineBuilder.append(line, 0, maxLength - ELLIPSIS.length()).append(ELLIPSIS); + return new TruncateResult(truncatedLineBuilder.toString(), diagnosticStart, diagnosticLength, false); + } + + if (diagnosticStart == 0 && diagnosticLength > maxLength - ELLIPSIS.length()) { + // TODO: Handle the case where diagnostic spans the entire terminal + truncatedLineBuilder.append(line, 0, diagnosticLength).append(ELLIPSIS); + return new TruncateResult(truncatedLineBuilder.toString(), 0, diagnosticLength, true); + } else if (diagnosticStart + diagnosticLength == line.length()) { + if (diagnosticLength > maxLength - ELLIPSIS.length()) { + truncatedLineBuilder.append(ELLIPSIS).append(line, diagnosticStart, diagnosticStart + diagnosticLength); + return new TruncateResult(truncatedLineBuilder.toString(), ELLIPSIS.length(), diagnosticLength, true); + } + } else if (diagnosticLength > maxLength - ELLIPSIS.length() * 2) { + truncatedLineBuilder.append(ELLIPSIS).append(line, diagnosticStart, diagnosticStart + diagnosticLength) + .append(ELLIPSIS); + return new TruncateResult(truncatedLineBuilder.toString(), ELLIPSIS.length(), diagnosticLength, true); + } + + int diagnosticMid = diagnosticStart + (diagnosticLength / 2); + int stepsToMoveWindow = Math.max(0, diagnosticMid - (maxLength / 2)); + int border = Math.min(line.length(), stepsToMoveWindow + maxLength - ELLIPSIS.length()); + int newDiagnosticStart = diagnosticStart - stepsToMoveWindow; + int stringStart = Math.min(stepsToMoveWindow + ELLIPSIS.length(), border); + + truncatedLineBuilder.append(ELLIPSIS).append(line, stringStart, border); + if (border < line.length()) { + truncatedLineBuilder.append(ELLIPSIS); + } + return new TruncateResult(truncatedLineBuilder.toString(), newDiagnosticStart, diagnosticLength, false); + } + + private static String replaceTabs(String line, int end) { + int endIndex = Math.min(end, line.length()); + return line.substring(0, endIndex).replace("\t", " ") + line.substring(endIndex); + } + + /** + * Represents a result of truncating a line. + * @param needsWrap If the result needs to be wrapped + * @param line The truncated line + * @param diagnosticStart The start of the diagnostic in the truncated line + * @param diagnosticLength The length of the diagnostic in the truncated line + */ + protected record TruncateResult(String line, int diagnosticStart, int diagnosticLength, boolean needsWrap) { + + } +} diff --git a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/CompileTask.java b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/CompileTask.java index ba0bd8f7aeba..ae1d97a82254 100644 --- a/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/CompileTask.java +++ b/cli/ballerina-cli/src/main/java/io/ballerina/cli/task/CompileTask.java @@ -18,6 +18,7 @@ package io.ballerina.cli.task; +import io.ballerina.cli.diagnostics.AnnotateDiagnostics; import io.ballerina.cli.utils.BuildTime; import io.ballerina.projects.CodeGeneratorResult; import io.ballerina.projects.CodeModifierResult; @@ -44,6 +45,7 @@ import java.io.PrintStream; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; @@ -59,6 +61,7 @@ * @since 2.0.0 */ public class CompileTask implements Task { + private final transient PrintStream out; private final transient PrintStream err; private final boolean compileForBalPack; @@ -218,13 +221,19 @@ public void execute(Project project) { BuildTime.getInstance().codeGenDuration = System.currentTimeMillis() - start; } + // HashSet to keep track of the diagnostics to avoid duplicate diagnostics + Set diagnosticSet = new HashSet<>(); + AnnotateDiagnostics annotateDiagnostics = new AnnotateDiagnostics(project.currentPackage()); + // Report package compilation and backend diagnostics diagnostics.addAll(jBallerinaBackend.diagnosticResult().diagnostics(false)); diagnostics.forEach(d -> { if (d.diagnosticInfo().code() == null || (!d.diagnosticInfo().code().equals( ProjectDiagnosticErrorCode.BUILT_WITH_OLDER_SL_UPDATE_DISTRIBUTION.diagnosticId()) && !d.diagnosticInfo().code().startsWith(TOOL_DIAGNOSTIC_CODE_PREFIX))) { - err.println(d); + if (diagnosticSet.add(d.toString())) { + err.println(annotateDiagnostics.renderDiagnostic(d)); + } } }); // Add tool resolution diagnostics to diagnostics diff --git a/cli/ballerina-cli/src/main/java/module-info.java b/cli/ballerina-cli/src/main/java/module-info.java index 5a4dc307a549..215e5b2ba5c3 100644 --- a/cli/ballerina-cli/src/main/java/module-info.java +++ b/cli/ballerina-cli/src/main/java/module-info.java @@ -5,9 +5,11 @@ exports io.ballerina.cli.launcher; exports io.ballerina.cli.utils; exports io.ballerina.cli.cmd; + exports io.ballerina.cli.diagnostics; requires io.ballerina.runtime; requires io.ballerina.lang; + requires io.ballerina.parser; requires io.ballerina.tools.api; requires io.ballerina.testerina.runtime; requires io.ballerina.testerina.core; diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/diagnostics/AnnotateDiagnosticsTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/diagnostics/AnnotateDiagnosticsTest.java new file mode 100644 index 000000000000..2e339253ddf7 --- /dev/null +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/diagnostics/AnnotateDiagnosticsTest.java @@ -0,0 +1,287 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.ballerina.cli.diagnostics; + +import io.ballerina.projects.Document; +import io.ballerina.projects.DocumentConfig; +import io.ballerina.projects.Package; +import io.ballerina.tools.diagnostics.Diagnostic; +import io.ballerina.tools.diagnostics.DiagnosticSeverity; +import org.ballerinalang.test.BCompileUtil; +import org.ballerinalang.test.CompileResult; +import org.testng.Assert; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import java.io.IOException; +import java.lang.reflect.Field; +import java.net.URI; +import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Map; +import java.util.Objects; + +import static io.ballerina.cli.utils.OsUtils.isWindows; + +/** + * Test cases for AnnotateDiagnostics class. + * + * @since 2201.10.0 + */ +public class AnnotateDiagnosticsTest { + + private Path testResources; + + @BeforeClass + public void setup() throws URISyntaxException { + URI testResourcesURI = Objects.requireNonNull( + getClass().getClassLoader().getResource("test-resources")).toURI(); + this.testResources = Paths.get(testResourcesURI).resolve("diagnostics-test-files"); + } + + @Test(description = "Test annotations when the source file contains missing tokens") + public void testMissingTokenAnnotation() throws IOException { + CompileResult result = BCompileUtil.compileOffline( + "test-resources/diagnostics-test-files/bal-missing-error/semicolon-missing.bal"); + Diagnostic[] diagnostics = result.getDiagnostics(); + String expectedOutput = Files.readString(testResources.resolve("bal-missing-error") + .resolve("semicolon-missing-expected.txt")); + Assert.assertTrue(diagnostics.length > 0); + Diagnostic diagnostic = diagnostics[0]; + AnnotateDiagnostics annotateDiagnostics = new AnnotateDiagnostics(result.project().currentPackage()); + String output = annotateDiagnostics.renderDiagnostic(diagnostic).toString(); + Assert.assertEquals(output, expectedOutput); + } + + @Test(description = "Test annotations when the source file contains a missing function keyword") + public void testMissingFunctionKeywordAnnotation() throws IOException { + CompileResult result = BCompileUtil.compileOffline( + "test-resources/diagnostics-test-files/bal-missing-error/missing-function-keyword.bal"); + Diagnostic[] diagnostics = result.getDiagnostics(); + String expectedOutput = Files.readString(testResources.resolve("bal-missing-error") + .resolve("missing-function-keyword-expected.txt")); + Assert.assertEquals(diagnostics.length, 1); + Diagnostic diagnostic = diagnostics[0]; + AnnotateDiagnostics annotateDiagnostics = new AnnotateDiagnostics(result.project().currentPackage()); + String output = annotateDiagnostics.renderDiagnostic(diagnostic).toString(); + Assert.assertEquals(output, expectedOutput); + } + + @Test(description = "Test annotations when the source file contains a missing keywords") + public void testMissingMultipleKeywordsAnnotation() throws IOException { + CompileResult result = BCompileUtil.compileOffline( + "test-resources/diagnostics-test-files/bal-missing-error/missing-multiple-keywords.bal"); + Diagnostic[] diagnostics = result.getDiagnostics(); + String expectedOutput = Files.readString(testResources.resolve("bal-missing-error") + .resolve("missing-multiple-keywords-expected.txt")); + Assert.assertTrue(diagnostics.length > 0); + String output = getAnnotatedDiagnostics(diagnostics, result.project().currentPackage()); + Assert.assertEquals(output, expectedOutput); + } + + @Test(description = "Test annotations when the source file contains invalid tokens") + void testInvalidTokenAnnotation() throws IOException { + CompileResult result = BCompileUtil.compileOffline( + "test-resources/diagnostics-test-files/bal-invalid-error/invalid-token.bal"); + Diagnostic[] diagnostics = result.getDiagnostics(); + String expectedOutput = Files.readString(testResources.resolve("bal-invalid-error") + .resolve("invalid-token-expected.txt")); + Assert.assertEquals(diagnostics.length, 1); + Diagnostic diagnostic = diagnostics[0]; + AnnotateDiagnostics annotateDiagnostics = new AnnotateDiagnostics(result.project().currentPackage()); + String output = annotateDiagnostics.renderDiagnostic(diagnostic).toString(); + Assert.assertEquals(output, expectedOutput); + } + + @DataProvider(name = "terminalWidthProvider") + public Object[][] terminalWidthProvider() { + return new Object[][]{ + {999}, + {200}, + {150}, + {100}, + {50}, + {40}, + {38} + }; + } + + @Test(description = "Test annotations when erroneous line is longer than the terminal width. Tests truncation", + dataProvider = "terminalWidthProvider") + void testLongLineAnnotation(int terminalWidth) throws IOException, NoSuchFieldException, IllegalAccessException { + CompileResult result = BCompileUtil.compileOffline( + "test-resources/diagnostics-test-files/bal-error/long-line.bal"); + Diagnostic[] diagnostics = result.getDiagnostics(); + AnnotateDiagnostics annotateDiagnostics = new AnnotateDiagnostics(result.project().currentPackage()); + Assert.assertEquals(diagnostics.length, 1); + Diagnostic diagnostic = diagnostics[0]; + Field terminalWidthField = AnnotateDiagnostics.class.getDeclaredField("terminalWidth"); + terminalWidthField.setAccessible(true); + terminalWidthField.setInt(annotateDiagnostics, terminalWidth); + String output = annotateDiagnostics.renderDiagnostic(diagnostic).toString(); + String expectedOutput = + Files.readString( + testResources.resolve("bal-error").resolve("long-line-expected" + terminalWidth + ".txt")); + Assert.assertEquals(output, expectedOutput); + } + + @Test(description = "Test annotations when a ballerina project contains errors in multiple files") + void testProjectErrorAnnotation() throws IOException { + CompileResult result = BCompileUtil.compileOffline( + "test-resources/diagnostics-test-files/bal-project-error/project1"); + Diagnostic[] diagnostics = result.getDiagnostics(); + String output = getAnnotatedDiagnostics(diagnostics, result.project().currentPackage()); + String expectedOutput = getExpectedOutput(testResources.resolve("bal-project-error"), "project1-expected.txt"); + Assert.assertEquals(output, expectedOutput); + + } + + @Test(description = "Test warning annotations in a ballerina project") + void testProjectWarningAnnotation() throws IOException { + CompileResult result = + BCompileUtil.compileWithoutInitInvocation( + "test-resources/diagnostics-test-files/bal-project-error/project2"); + Diagnostic[] diagnostics = result.getDiagnostics(); + AnnotateDiagnostics annotateDiagnostics = new AnnotateDiagnostics(result.project().currentPackage()); + StringBuilder output = new StringBuilder(); + for (Diagnostic diagnostic : diagnostics) { + if (diagnostic.diagnosticInfo().severity() != DiagnosticSeverity.WARNING) { + continue; + } + output.append(annotateDiagnostics.renderDiagnostic(diagnostic).toString()); + output.append(System.lineSeparator()); + } + String expectedOutput = + getExpectedOutput(testResources.resolve("bal-project-error"), "project2-expected-warnings.txt"); + Assert.assertEquals(output.toString(), expectedOutput); + } + + @Test(description = "Test hint annotations in a ballerina project") + void testProjectHintAnnotation() throws IOException { + CompileResult result = BCompileUtil.compileWithoutInitInvocation( + "test-resources/diagnostics-test-files/bal-project-error/project2"); + Diagnostic[] diagnostics = result.getDiagnostics(); + AnnotateDiagnostics annotateDiagnostics = new AnnotateDiagnostics(result.project().currentPackage()); + StringBuilder output = new StringBuilder(); + for (Diagnostic diagnostic : diagnostics) { + if (diagnostic.diagnosticInfo().severity() != DiagnosticSeverity.HINT) { + continue; + } + output.append(annotateDiagnostics.renderDiagnostic(diagnostic).toString()); + output.append(System.lineSeparator()); + } + String expectedOutput = + getExpectedOutput(testResources.resolve("bal-project-error"), "project2-expected-hints.txt"); + Assert.assertEquals(output.toString(), expectedOutput); + } + + @Test(description = "Test annotations spanning two lines in the source file") + void testTwoLinedAnnotations() throws IOException { + CompileResult result = + BCompileUtil.compile("test-resources/diagnostics-test-files/bal-error/two-line-error.bal"); + Diagnostic[] diagnostics = result.getDiagnostics(); + String output = getAnnotatedDiagnostics(diagnostics, result.project().currentPackage()); + String expectedOutput = + Files.readString(testResources.resolve("bal-error").resolve("two-line-error-expected.txt")); + Assert.assertEquals(output, expectedOutput); + } + + @Test(description = "Test annotations when the source file contains diagnostics spanning multiple lines") + void testMultiLinedAnnotations() throws IOException { + CompileResult result = + BCompileUtil.compile("test-resources/diagnostics-test-files/bal-error/multi-line.bal"); + Diagnostic[] diagnostics = result.getDiagnostics(); + String output = getAnnotatedDiagnostics(diagnostics, result.project().currentPackage()); + String expectedOutput = Files.readString(testResources.resolve("bal-error").resolve("multi-line-expected.txt")); + Assert.assertEquals(output, expectedOutput); + } + + @Test(description = "Test annotations when the source file contains tabs instead of spaces") + void testAnnotationsWithTabs() throws IOException { + CompileResult result = BCompileUtil.compile("test-resources/diagnostics-test-files/bal-error/tabs.bal"); + Diagnostic[] diagnostics = result.getDiagnostics(); + String output = getAnnotatedDiagnostics(diagnostics, result.project().currentPackage()); + String expectedOutput = Files.readString(testResources.resolve("bal-error").resolve("tabs-expected.txt")); + Assert.assertEquals(output, expectedOutput); + } + + @Test(description = "Test non terminal node missing annotations") + void testNonTerminalNodeMissingAnnotation() throws IOException { + CompileResult result = BCompileUtil.compile( + "test-resources/diagnostics-test-files/bal-missing-error/missing-non-terminal.bal"); + Diagnostic[] diagnostics = result.getDiagnostics(); + String expectedOutput = Files.readString(testResources.resolve("bal-missing-error") + .resolve("missing-non-terminal-expected.txt")); + Assert.assertEquals(diagnostics.length, 8); + String output = getAnnotatedDiagnostics(diagnostics, result.project().currentPackage()); + Assert.assertEquals(output, expectedOutput); + } + + @Test(description = "Test missing token annotation padding") + void testMissingTokenAnnotationPadding() throws IOException, NoSuchFieldException, IllegalAccessException { + CompileResult result = BCompileUtil.compile( + "test-resources/diagnostics-test-files/bal-missing-error/missing-function-keyword.bal"); + Diagnostic[] diagnostics = result.getDiagnostics(); + Assert.assertEquals(diagnostics.length, 1); + + AnnotateDiagnostics annotateDiagnostics = new AnnotateDiagnostics(result.project().currentPackage()); + Field documentMapField = AnnotateDiagnostics.class.getDeclaredField("documentMap"); + documentMapField.setAccessible(true); + Assert.assertTrue(documentMapField.get(annotateDiagnostics) instanceof Map); + Object value = documentMapField.get(annotateDiagnostics); + Assert.assertTrue(value instanceof Map); + Map documentMap = (Map) value; + + Document document = documentMap.get(diagnostics[0].location().lineRange().fileName()); + int index = diagnostics[0].location().textRange().startOffset(); + + String documentString = " " + document.textDocument().toString().substring(0, index - 1) + + document.textDocument().toString().substring(index); + DocumentConfig documentConfig = DocumentConfig.from(document.documentId(), documentString, document.name()); + Document updatedDocument = Document.from(documentConfig, document.module()); + documentMap.put(diagnostics[0].location().lineRange().fileName(), updatedDocument); + + String output = annotateDiagnostics.renderDiagnostic(diagnostics[0]).toString(); + String expectedOutput = Files.readString(testResources.resolve("bal-missing-error") + .resolve("missing-token-padding-expected.txt")); + + Assert.assertEquals(output, expectedOutput); + } + + private static String getAnnotatedDiagnostics(Diagnostic[] diagnostics, Package currentPackage) { + StringBuilder output = new StringBuilder(); + AnnotateDiagnostics annotateDiagnostics = new AnnotateDiagnostics(currentPackage); + for (Diagnostic diagnostic : diagnostics) { + output.append(annotateDiagnostics.renderDiagnostic(diagnostic).toString()); + output.append(System.lineSeparator()); + } + return output.toString(); + } + + private static String getExpectedOutput(Path path, String fileName) throws IOException { + if (isWindows()) { + return Files.readString(path.resolve("windows").resolve(fileName)).replaceAll("\r", ""); + } else { + return Files.readString(path.resolve("unix").resolve(fileName)); + } + } +} diff --git a/cli/ballerina-cli/src/test/java/io/ballerina/cli/diagnostics/DiagnosticAnnotationTest.java b/cli/ballerina-cli/src/test/java/io/ballerina/cli/diagnostics/DiagnosticAnnotationTest.java new file mode 100644 index 000000000000..7d50ffaccb1b --- /dev/null +++ b/cli/ballerina-cli/src/test/java/io/ballerina/cli/diagnostics/DiagnosticAnnotationTest.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.ballerina.cli.diagnostics; + +import io.ballerina.tools.diagnostics.DiagnosticSeverity; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.util.HashMap; +import java.util.Map; + +/** + * Test cases for DiagnosticAnnotation class. + * + * @since 2201.10.0 + */ +public class DiagnosticAnnotationTest { + + @Test + public void testColorAnnotations() { + String errorColor = DiagnosticAnnotation.SEVERITY_COLORS.get(DiagnosticSeverity.ERROR); + String warningColor = DiagnosticAnnotation.SEVERITY_COLORS.get(DiagnosticSeverity.WARNING); + String hintColor = DiagnosticAnnotation.SEVERITY_COLORS.get(DiagnosticSeverity.HINT); + String message = "Hello World!"; + + String errorMessage = DiagnosticAnnotation.getColoredString(message, errorColor, true); + String expected = + DiagnosticAnnotation.JANSI_ANNOTATOR + "red" + " " + message + DiagnosticAnnotation.JANSI_RESET; + Assert.assertEquals(errorMessage, expected); + + String warningMessage = DiagnosticAnnotation.getColoredString(message, warningColor, true); + expected = DiagnosticAnnotation.JANSI_ANNOTATOR + "yellow" + " " + message + DiagnosticAnnotation.JANSI_RESET; + Assert.assertEquals(warningMessage, expected); + + String hintMessage = DiagnosticAnnotation.getColoredString(message, hintColor, true); + expected = DiagnosticAnnotation.JANSI_ANNOTATOR + "green" + " " + message + DiagnosticAnnotation.JANSI_RESET; + Assert.assertEquals(hintMessage, expected); + } + + @Test + public void testTruncation() { + String message = "This is a long message that needs to be truncated"; + int importantPartStart = 15; + int importantPartLength = 7; + Map truncatedLines = new HashMap<>(); + truncatedLines.put(49, "This is a long message that needs to be truncated"); + truncatedLines.put(30, "This is a long message that..."); + truncatedLines.put(25, "This is a long message..."); + truncatedLines.put(20, "...ong message th..."); + truncatedLines.put(13, "...message..."); + truncatedLines.put(10, "...essa..."); + truncatedLines.put(5, "......"); + truncatedLines.put(0, "......"); + + int[] lengths = {49, 30, 25, 20, 13, 10, 5, 0}; + for (int length : lengths) { + DiagnosticAnnotation.TruncateResult truncatedMessage = + DiagnosticAnnotation.truncate(message, length, importantPartStart, importantPartLength); + String expected = truncatedLines.get(length); + Assert.assertEquals(truncatedMessage.line(), expected); + } + } + +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bal-with-absolute-jar-path.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bal-with-absolute-jar-path.txt index 10f97cb46a11..2c2de9e12b96 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bal-with-absolute-jar-path.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bal-with-absolute-jar-path.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bar-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bar-bal.txt index 55fbccbf4a4a..4e90569f1e79 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bar-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-bar-bal.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable bar.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-foo-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-foo-bal.txt index 076d9df06c38..243a73fc432e 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-foo-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-foo-bal.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable foo.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal-with-build-options.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal-with-build-options.txt index bf62e658690d..99fdcb2cdb49 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal-with-build-options.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal-with-build-options.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable hello_world.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal.txt index bf62e658690d..99fdcb2cdb49 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-hello-world-bal.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable hello_world.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-project-with-empty-ballerina-toml.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-project-with-empty-ballerina-toml.txt index ed846965f54f..b91445c7aa0b 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-project-with-empty-ballerina-toml.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-project-with-empty-ballerina-toml.txt @@ -5,6 +5,7 @@ WARNING [Ballerina.toml:(1:1,1:1)] missing table '[package]' in 'Ballerina.toml' org = "john" name = "validProjectWithEmptyBallerinaToml" version = "0.1.0" +(BCE5001) Generating executable target/bin/validProjectWithEmptyBallerinaToml.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-bal.txt index 242b9d8033e4..f0098abf2f41 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-bal.txt @@ -1,4 +1,8 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files -ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) +ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' (BCE0600) + | +2 | };; + | ^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-package.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-package.txt index 748e446c1e67..a69eff61ff8b 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-package.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/build-syntax-err-package.txt @@ -1,3 +1,7 @@ Compiling source foo/winery:0.1.0 -ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' +ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' (BCE0600) + | +2 | };; + | ^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/dump-build-time-standalone.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/dump-build-time-standalone.txt index 2c5b1c6c542c..8d71bbfcda15 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/dump-build-time-standalone.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/dump-build-time-standalone.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable hello_world.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/project-with-provided-warning.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/project-with-provided-warning.txt index 0c5296acdd2f..b08037712ac3 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/project-with-provided-warning.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/project-with-provided-warning.txt @@ -1,7 +1,15 @@ Compiling source foo/pkg_b:1.0.0 -WARNING [main.bal:(26:5,26:41)] unused variable 'msgHello' -WARNING [main.bal:(27:5,27:53)] unused variable 'msg' +WARNING [main.bal:(26:5,26:41)] unused variable 'msgHello' (BCE20403) + | +26 | string msgHello = pkg_a:helloCall(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(27:5,27:53)] unused variable 'msg' (BCE20403) + | +27 | handle? msg = greeting(java:fromString("Jane")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Generating executable diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/run-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/run-bal.txt index 7418db727411..7298e53ca9ca 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/run-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/run-bal.txt @@ -1,7 +1,11 @@ Compiling source file_create.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files -WARNING [file_create.bal:(6:4,6:58)] unused variable 'isSuccess' +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) +WARNING [file_create.bal:(6:4,6:58)] unused variable 'isSuccess' (BCE20403) + | +6 | boolean|error isSuccess = createNewFileInternal(file); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running executable diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/run-project-with-provided-dep.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/run-project-with-provided-dep.txt index 40189cda7c25..3947e28698dc 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/run-project-with-provided-dep.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/unix/run-project-with-provided-dep.txt @@ -1,6 +1,14 @@ Compiling source foo/pkg_b:1.0.0 -WARNING [main.bal:(26:5,26:41)] unused variable 'msgHello' -WARNING [main.bal:(27:5,27:53)] unused variable 'msg' +WARNING [main.bal:(26:5,26:41)] unused variable 'msgHello' (BCE20403) + | +26 | string msgHello = pkg_a:helloCall(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(27:5,27:53)] unused variable 'msg' (BCE20403) + | +27 | handle? msg = greeting(java:fromString("Jane")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running executable \ No newline at end of file diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bal-with-absolute-jar-path.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bal-with-absolute-jar-path.txt index 10f97cb46a11..2c2de9e12b96 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bal-with-absolute-jar-path.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bal-with-absolute-jar-path.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bar-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bar-bal.txt index 55fbccbf4a4a..4e90569f1e79 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bar-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-bar-bal.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable bar.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-foo-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-foo-bal.txt index 076d9df06c38..243a73fc432e 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-foo-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-foo-bal.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable foo.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal-with-build-options.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal-with-build-options.txt index bf62e658690d..99fdcb2cdb49 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal-with-build-options.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal-with-build-options.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable hello_world.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal.txt index bf62e658690d..99fdcb2cdb49 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-hello-world-bal.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable hello_world.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-project-with-empty-ballerina-toml.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-project-with-empty-ballerina-toml.txt index 944bda503633..2eb7ac0fbc21 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-project-with-empty-ballerina-toml.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-project-with-empty-ballerina-toml.txt @@ -5,6 +5,7 @@ WARNING [Ballerina.toml:(1:1,1:1)] missing table '[package]' in 'Ballerina.toml' org = "john" name = "validProjectWithEmptyBallerinaToml" version = "0.1.0" +(BCE5001) Generating executable target\bin\validProjectWithEmptyBallerinaToml.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-bal.txt index 242b9d8033e4..f0098abf2f41 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-bal.txt @@ -1,4 +1,8 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files -ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) +ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' (BCE0600) + | +2 | };; + | ^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-package.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-package.txt index 748e446c1e67..a69eff61ff8b 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-package.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/build-syntax-err-package.txt @@ -1,3 +1,7 @@ Compiling source foo/winery:0.1.0 -ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' +ERROR [hello_world.bal:(2:3,2:4)] invalid token ';' (BCE0600) + | +2 | };; + | ^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/dump-build-time-standalone.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/dump-build-time-standalone.txt index 2c5b1c6c542c..8d71bbfcda15 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/dump-build-time-standalone.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/dump-build-time-standalone.txt @@ -1,6 +1,6 @@ Compiling source hello_world.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) Generating executable hello_world.jar diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/project-with-provided-warning.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/project-with-provided-warning.txt index 8d8206099dfd..3a6b0250097e 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/project-with-provided-warning.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/project-with-provided-warning.txt @@ -1,7 +1,15 @@ Compiling source foo/pkg_b:1.0.0 -WARNING [main.bal:(26:5,26:41)] unused variable 'msgHello' -WARNING [main.bal:(27:5,27:53)] unused variable 'msg' +WARNING [main.bal:(26:5,26:41)] unused variable 'msgHello' (BCE20403) + | +26 | string msgHello = pkg_a:helloCall(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(27:5,27:53)] unused variable 'msg' (BCE20403) + | +27 | handle? msg = greeting(java:fromString("Jane")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Generating executable diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/run-bal.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/run-bal.txt index 7418db727411..7298e53ca9ca 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/run-bal.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/run-bal.txt @@ -1,7 +1,11 @@ Compiling source file_create.bal -WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files -WARNING [file_create.bal:(6:4,6:58)] unused variable 'isSuccess' +WARNING [:(1:1,1:1)] Skipped adding the generated source file with prefix "dummyfunc". Source file generation is not supported with standalone bal files (BCE5401) +WARNING [file_create.bal:(6:4,6:58)] unused variable 'isSuccess' (BCE20403) + | +6 | boolean|error isSuccess = createNewFileInternal(file); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running executable diff --git a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/run-project-with-provided-dep.txt b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/run-project-with-provided-dep.txt index 40189cda7c25..3947e28698dc 100644 --- a/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/run-project-with-provided-dep.txt +++ b/cli/ballerina-cli/src/test/resources/test-resources/command-outputs/windows/run-project-with-provided-dep.txt @@ -1,6 +1,14 @@ Compiling source foo/pkg_b:1.0.0 -WARNING [main.bal:(26:5,26:41)] unused variable 'msgHello' -WARNING [main.bal:(27:5,27:53)] unused variable 'msg' +WARNING [main.bal:(26:5,26:41)] unused variable 'msgHello' (BCE20403) + | +26 | string msgHello = pkg_a:helloCall(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(27:5,27:53)] unused variable 'msg' (BCE20403) + | +27 | handle? msg = greeting(java:fromString("Jane")); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running executable \ No newline at end of file diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected100.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected100.txt new file mode 100644 index 000000000000..ef3e6da93c8a --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected100.txt @@ -0,0 +1,4 @@ +ERROR [long-line.bal:(2:68,2:96)] operator '+' not defined for 'int' and 'string' (BCE2070) + | +2 | ...3 + 1 + 2 + 3 + 2 + 1 + 2 + 3, 4 + 5 + 6 + 7 + 8 + 9 + "10" + 13 + 14 + 15 + 16 + 17 + 18 ... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected150.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected150.txt new file mode 100644 index 000000000000..019f9056d240 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected150.txt @@ -0,0 +1,4 @@ +ERROR [long-line.bal:(2:68,2:96)] operator '+' not defined for 'int' and 'string' (BCE2070) + | +2 | int c = add(1 + 2 + 3 + 1 + 2 + 3 + 1 + 2 + 3 + 2 + 1 + 2 + 3, 4 + 5 + 6 + 7 + 8 + 9 + "10" + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + ... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected200.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected200.txt new file mode 100644 index 000000000000..04b453524ec9 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected200.txt @@ -0,0 +1,4 @@ +ERROR [long-line.bal:(2:68,2:96)] operator '+' not defined for 'int' and 'string' (BCE2070) + | +2 | int c = add(1 + 2 + 3 + 1 + 2 + 3 + 1 + 2 + 3 + 2 + 1 + 2 + 3, 4 + 5 + 6 + 7 + 8 + 9 + "10" + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + ... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected38.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected38.txt new file mode 100644 index 000000000000..209752195553 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected38.txt @@ -0,0 +1,4 @@ +ERROR [long-line.bal:(2:68,2:96)] operator '+' not defined for 'int' and 'string' (BCE2070) + | +2 | ...4 + 5 + 6 + 7 + 8 + 9 + "10"... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected40.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected40.txt new file mode 100644 index 000000000000..dc38889bc550 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected40.txt @@ -0,0 +1,4 @@ +ERROR [long-line.bal:(2:68,2:96)] operator '+' not defined for 'int' and 'string' (BCE2070) + | +2 | ... 4 + 5 + 6 + 7 + 8 + 9 + "10" ... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected50.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected50.txt new file mode 100644 index 000000000000..5102e1201f15 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected50.txt @@ -0,0 +1,4 @@ +ERROR [long-line.bal:(2:68,2:96)] operator '+' not defined for 'int' and 'string' (BCE2070) + | +2 | ... + 3, 4 + 5 + 6 + 7 + 8 + 9 + "10" + 13 ... + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected999.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected999.txt new file mode 100644 index 000000000000..fc86cac7ab73 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line-expected999.txt @@ -0,0 +1,4 @@ +ERROR [long-line.bal:(2:68,2:96)] operator '+' not defined for 'int' and 'string' (BCE2070) + | +2 | int c = add(1 + 2 + 3 + 1 + 2 + 3 + 1 + 2 + 3 + 2 + 1 + 2 + 3, 4 + 5 + 6 + 7 + 8 + 9 + "10" + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line.bal new file mode 100644 index 000000000000..f78a12df4500 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/long-line.bal @@ -0,0 +1,7 @@ +public function main() { + int c = add(1 + 2 + 3 + 1 + 2 + 3 + 1 + 2 + 3 + 2 + 1 + 2 + 3, 4 + 5 + 6 + 7 + 8 + 9 + "10" + 13 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28 + 29 + 30 + 31 + 32 + 33 + 34 + 35 + 36 + 37 + 38 + 39 + 40); +} + +public function add(int a, int b) returns int { + return a + b; +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/multi-line-expected.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/multi-line-expected.txt new file mode 100644 index 000000000000..bb06433a5089 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/multi-line-expected.txt @@ -0,0 +1,277 @@ +ERROR [multi-line.bal:(62:38,62:45)] incompatible types: expected 'Person', found 'Teacher' (BCE2066) + | +62 | Person[] outputPersonList = from Teacher person in personList + | ^^^^^^^ + +ERROR [multi-line.bal:(65:23,65:38)] undeclared field 'lastName' in record 'Teacher' (BCE2119) + | +65 | lastName: person.lastName, + | ^^^^^^^^^^^^^^^ + +ERROR [multi-line.bal:(66:18,66:28)] undeclared field 'age' in record 'Teacher' (BCE2119) + | +66 | age: person.age + | ^^^^^^^^^^ + +ERROR [multi-line.bal:(81:18,81:21)] unknown type 'XYZ' (BCE2069) + | +81 | from XYZ person in personList + | ^^^ + +ERROR [multi-line.bal:(101:9,101:17)] undefined field 'lastName' in record 'Teacher' (BCE2023) + | +101 | lastName: person.lastName + | ^^^^^^^^ + +ERROR [multi-line.bal:(114:32,114:34)] incompatible types: 'int' is not an iterable collection (BCE2800) + | +114 | from var person in 10 + | ^^ + +ERROR [multi-line.bal:(115:11,115:13)] incompatible types: expected 'boolean', found 'int' (BCE2066) + | +115 | where 20 + | ^^ + +ERROR [multi-line.bal:(116:12,116:14)] incompatible types: expected 'Person', found 'int' (BCE2066) + | +116 | select 30; + | ^^ + +ERROR [multi-line.bal:(130:12,133:6)] missing non-defaultable required record field 'lastName' (BCE2520) + | +130 | select { + : | ^ + : | : + : | : +133 | }; + | ^^^^^ + +ERROR [multi-line.bal:(151:16,151:28)] incompatible types: expected 'float', found 'int' (BCE2066) + | +151 | score: invalidScore + | ^^^^^^^^^^^^ + +ERROR [multi-line.bal:(166:26,166:42)] undefined function 'calculateScore' (BCE2011) + | +166 | let float avgScore = calculateScore() + | ^^^^^^^^^^^^^^^^ + +ERROR [multi-line.bal:(203:6,203:34)] invalid record binding pattern; unknown field 'fname' in record type 'Student' (BCE2576) + | +203 | from var {fname, lastName, score} in studentList + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +ERROR [multi-line.bal:(205:20,205:25)] undefined symbol 'fname' (BCE2010) + | +205 | firstName: fname, + | ^^^^^ + +ERROR [multi-line.bal:(220:12,220:19)] incompatible types: expected 'Student', found '(string|float)' (BCE2066) + | +220 | select student; + | ^^^^^^^ + +ERROR [multi-line.bal:(239:18,239:23)] incompatible types: expected 'Address', found 'map' (BCE2066) + | +239 | address: addr1 + | ^^^^^ + +ERROR [multi-line.bal:(264:12,264:26)] incompatible types: expected 'FullName[]', found '()' (BCE2066) + | +264 | return outputNameList; + | ^^^^^^^^^^^^^^ + +ERROR [multi-line.bal:(276:12,276:22)] incompatible types: expected 'string', found 'int' (BCE2066) + | +276 | select person.age; + | ^^^^^^^^^^ + +ERROR [multi-line.bal:(290:12,293:6)] a type compatible with mapping constructor expressions not found in type 'string' (BCE2508) + | +290 | select { + : | ^ + : | : + : | : +293 | }; + | ^^^^^ + +ERROR [multi-line.bal:(349:36,349:41)] redeclared symbol 'fname' (BCE2008) + | +349 | Employee[] records = from var {fname, lname, age} in entities + | ^^^^^ + +ERROR [multi-line.bal:(363:13,363:16)] redeclared symbol 'age' (BCE2008) + | +363 | let int age = 35 + | ^^^ + +ERROR [multi-line.bal:(380:44,380:47)] redeclared symbol 'age' (BCE2008) + | +380 | from var {firstName, lastName, age} in personList + | ^^^ + +ERROR [multi-line.bal:(400:11,400:14)] invalid constraint type. expected subtype of 'map' but found 'int' (BCE3300) + | +400 | table ids = from var x in t + | ^^^ + +ERROR [multi-line.bal:(400:22,401:20)] invalid constraint type. expected subtype of 'map' but found 'int' (BCE3300) + | +400 | table ids = from var x in t + | ^^^^^^^^^^^^^^^ +401 | select x.id; + | ^^^^^^^^^^^^^^^^^^^ + +ERROR [multi-line.bal:(411:11,411:14)] invalid constraint type. expected subtype of 'map' but found 'int' (BCE3300) + | +411 | table ids = from var {id} in t + | ^^^ + +ERROR [multi-line.bal:(411:22,412:18)] invalid constraint type. expected subtype of 'map' but found 'int' (BCE3300) + | +411 | table ids = from var {id} in t + | ^^^^^^^^^^^^^^^^^^ +412 | select id; + | ^^^^^^^^^^^^^^^^^ + +ERROR [multi-line.bal:(417:29,417:30)] incompatible types: 'int' is not an iterable collection (BCE2800) + | +417 | int[] w = from var a in x + | ^ + +ERROR [multi-line.bal:(422:12,423:22)] incompatible types: expected 'error?', found 'stream' (BCE2066) + | +422 | return stream from string num in clientStream + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +423 | select {a: 1}; + | ^^^^^^^^^^^^^^^^^^^^^ + +ERROR [multi-line.bal:(428:22,428:29)] invalid record binding pattern with type 'anydata' (BCE2607) + | +428 | var x = map from var {k} in keyValsMap + | ^^^^^^^ + +ERROR [multi-line.bal:(429:16,429:17)] undefined symbol 'k' (BCE2010) + | +429 | select k; + | ^ + +ERROR [multi-line.bal:(434:22,434:29)] invalid record binding pattern with type 'any' (BCE2607) + | +434 | var x = map from var {k} in keyValsMap + | ^^^^^^^ + +ERROR [multi-line.bal:(435:16,435:17)] undefined symbol 'k' (BCE2010) + | +435 | select k; + | ^ + +ERROR [multi-line.bal:(453:28,453:30)] field name 'id' used in key specifier is not found in table constraint type 'record {| User user; |}' (BCE3306) + | +453 | var result = table key(id) from var user in users + | ^^ + +ERROR [multi-line.bal:(458:24,458:26)] field name 'id' used in key specifier is not found in table constraint type 'record {| User user; |}' (BCE3306) + | +458 | result = table key(id) from var user in userList + | ^^ + +ERROR [multi-line.bal:(471:28,471:30)] field name 'id' used in key specifier is not found in table constraint type 'record {| User user; |}' (BCE3306) + | +471 | var result = table key(id, firstName) from var user in users + | ^^ + +ERROR [multi-line.bal:(471:32,471:41)] field name 'firstName' used in key specifier is not found in table constraint type 'record {| User user; |}' (BCE3306) + | +471 | var result = table key(id, firstName) from var user in users + | ^^^^^^^^^ + +ERROR [multi-line.bal:(476:24,476:26)] field name 'id' used in key specifier is not found in table constraint type 'record {| User user; |}' (BCE3306) + | +476 | result = table key(id, firstName) from var user in userList + | ^^ + +ERROR [multi-line.bal:(476:28,476:37)] field name 'firstName' used in key specifier is not found in table constraint type 'record {| User user; |}' (BCE3306) + | +476 | result = table key(id, firstName) from var user in userList + | ^^^^^^^^^ + +ERROR [multi-line.bal:(492:14,492:17)] incompatible types: expected 'ScoreEventType', found 'int' (BCE2066) + | +492 | _ = from int ev in events + | ^^^ + +ERROR [multi-line.bal:(496:1,496:14)] unknown type 'UndefinedType' (BCE2069) + | +496 | UndefinedType[] undefinedTypeList = []; + | ^^^^^^^^^^^^^ + +ERROR [multi-line.bal:(507:14,507:27)] unknown type 'UndefinedType' (BCE2069) + | +507 | join UndefinedType item in undefinedTypeList + | ^^^^^^^^^^^^^ + +ERROR [multi-line.bal:(516:29,516:31)] field name 'id' used in key specifier is not found in table constraint type 'record {| User user; |}' (BCE3306) + | +516 | var result1 = table key(id) from var user in users + | ^^ + +ERROR [multi-line.bal:(519:21,519:22)] incompatible types: expected 'error?', found 'int' (BCE2066) + | +519 | on conflict 1; + | ^ + +ERROR [multi-line.bal:(521:29,521:31)] field name 'id' used in key specifier is not found in table constraint type 'record {| User user; |}' (BCE3306) + | +521 | var result2 = table key(id) from var user in users + | ^^ + +ERROR [multi-line.bal:(524:21,524:24)] incompatible types: expected 'error?', found '(error|int)' (BCE2066) + | +524 | on conflict msg; + | ^^^ + +ERROR [multi-line.bal:(529:16,529:17)] incompatible types: expected 'int', found 'string' (BCE2066) + | +529 | select s); + | ^ + +ERROR [multi-line.bal:(534:20,534:28)] incompatible types: expected 'int', found 'string' (BCE2066) + | +534 | select s.trim()); + | ^^^^^^^^ + +WARNING [multi-line.bal:(548:15,548:26)] invalid usage of the 'check' expression operator: no expression type is equivalent to error type (BCE20404) + | +548 | check returnNil(); + | ^^^^^^^^^^^ + +WARNING [multi-line.bal:(557:15,557:26)] invalid usage of the 'check' expression operator: no expression type is equivalent to error type (BCE20404) + | +557 | check returnNil(); + | ^^^^^^^^^^^ + +ERROR [multi-line.bal:(578:13,582:28)] incompatible types: expected 'int', found 'string[]' (BCE2066) + | +578 | from var person in + : | ^^^^^^^^^^^^^^^^^^ + : | : + : | : +582 | select person.firstName; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +ERROR [multi-line.bal:(588:12,588:28)] incompatible types: expected 'PersonA', found 'string' (BCE2066) + | +588 | select person.firstName; + | ^^^^^^^^^^^^^^^^ + +ERROR [multi-line.bal:(590:28,593:32)] incompatible types: expected 'PersonA', found 'string[]' (BCE2066) + | +590 | PersonA outputPerson = from var person in personList + : | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + : | : + : | : +593 | select person.firstName; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/multi-line.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/multi-line.bal new file mode 100644 index 000000000000..d0897f96462d --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/multi-line.bal @@ -0,0 +1,594 @@ +// Copyright (c) 2020 WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +// +// WSO2 Inc. licenses this file to you under the Apache License, +// Version 2.0 (the "License"); you may not use this file except +// in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +type Person record {| + string firstName; + string lastName; + int age; +|}; + +type Teacher record {| + string firstName; +|}; + +type Department record {| + string name; +|}; + +type Student record {| + string firstName; + string lastName; + float score; +|}; + +type FullName record {| + string firstName; + string lastName; +|}; + +type Person1 record {| + string firstName; + string lastName; + string deptAccess; + Address address; +|}; + +type Address record {| + string city; + string country; +|}; + +function testFromClauseWithInvalidType() returns Person[] { + + Person p1 = {firstName: "Alex", lastName: "George", age: 23}; + Person p2 = {firstName: "Ranjan", lastName: "Fonseka", age: 30}; + Person p3 = {firstName: "John", lastName: "David", age: 33}; + + Person[] personList = [p1, p2, p3]; + + Person[] outputPersonList = from Teacher person in personList + select { + firstName: person.firstName, + lastName: person.lastName, + age: person.age + }; + + return outputPersonList; +} + +function testFromClauseWithUnDefinedType() returns Person[] { + + Person p1 = {firstName: "Alex", lastName: "George", age: 23}; + Person p2 = {firstName: "Ranjan", lastName: "Fonseka", age: 30}; + Person p3 = {firstName: "John", lastName: "David", age: 33}; + + Person[] personList = [p1, p2, p3]; + + Person[] outputPersonList = + from XYZ person in personList + select { + firstName: person.firstName, + lastName: person.lastName, + age: person.age + }; + + return outputPersonList; +} + +function testSelectTypeMismatch() { + Person[] personList = [ + {firstName: "Alex", lastName: "George", age: 23}, + {firstName: "Ranjan", lastName: "Fonseka", age: 30} + ]; + + Teacher[] outputPersonList = + from Person person in personList + select { + firstName: person.firstName, + lastName: person.lastName + }; +} + +function testQueryWithInvalidExpressions() returns Person[] { + + Person p1 = {firstName: "Alex", lastName: "George", age: 23}; + Person p2 = {firstName: "Ranjan", lastName: "Fonseka", age: 30}; + Person p3 = {firstName: "John", lastName: "David", age: 33}; + + Person[] personList = [p1, p2, p3]; + + Person[] outputPersonList = + from var person in 10 + where 20 + select 30; + + return outputPersonList; +} + +function testMissingRequiredRecordField() returns Student[] { + + Student s1 = {firstName: "Alex", lastName: "George", score: 82.5}; + Student s2 = {firstName: "Ranjan", lastName: "Fonseka", score: 90.6}; + + Student[] studentList = [s1, s2]; + + Student[] outputStudentList = +from var student in studentList + select { + firstName: student.firstName, + score: student.score + }; + + return outputStudentList; +} + +function testInvalidFieldValueInSelect() returns Student[] { + + Student s1 = {firstName: "Alex", lastName: "George", score: 82.5}; + Student s2 = {firstName: "Ranjan", lastName: "Fonseka", score: 90.6}; + + Student[] studentList = [s1, s2]; + + Student[] outputStudentList = + from var student in studentList + let int invalidScore = 90 + select { + firstName: student.firstName, + lastName: student.lastName, + score: invalidScore + }; + + return outputStudentList; +} + +function testUndefinedFunctionInLet() returns Student[] { + + Student s1 = {firstName: "Alex", lastName: "George", score: 82.5}; + Student s2 = {firstName: "Ranjan", lastName: "Fonseka", score: 90.6}; + + Student[] studentList = [s1, s2]; + + Student[] outputStudentList = +from var student in studentList + let float avgScore = calculateScore() + select { + firstName: student.firstName, + lastName: student.lastName, + score: avgScore + }; + + return outputStudentList; +} + +function testDuplicateKeyInSelect() returns Student[] { + + Student s1 = {firstName: "Alex", lastName: "George", score: 82.5}; + Student s2 = {firstName: "Ranjan", lastName: "Fonseka", score: 90.6}; + + Student[] studentList = [s1, s2]; + + Student[] outputStudentList = +from var student in studentList + select { + firstName: student.firstName, + lastName: student.lastName, + score: student.score, + lastName: student.lastName + }; + + return outputStudentList; +} + +function testInvalidRecordBindingPattern() returns Student[] { + + Student s1 = {firstName: "Alex", lastName: "George", score: 82.5}; + Student s2 = {firstName: "Ranjan", lastName: "Fonseka", score: 90.6}; + + Student[] studentList = [s1, s2]; + + Student[] outputStudentList = +from var {fname, lastName, score} in studentList + select { + firstName: fname, + lastName: lastName, + score: score + }; + + return outputStudentList; +} + +function testIncompatibleTypesInFrom() returns Student[] { + + Student s1 = {firstName: "Alex", lastName: "George", score: 82.5}; + Student s2 = {firstName: "Ranjan", lastName: "Fonseka", score: 90.6}; + + Student[] outputStudentList = +from var student in s1 + select student; + + return outputStudentList; +} + +function testMapAssignmetToRecordTypesWithRequiredFields() returns Person1[] { + + Person1 p1 = {firstName: "Alex", lastName: "George", deptAccess: "XYZ", address: {city: "NY", country: "America"}}; + Person1 p2 = {firstName: "Ranjan", lastName: "Fonseka", deptAccess: "XYZ", address: {city: "NY", country: "America"}}; + + Person1[] personList = [p1, p2]; + map addr1 = {city: "Manchester", country: "UK"}; + + Person1[] outputPersonList = +from var person in personList + select { + firstName: person.firstName, + lastName: person.lastName, + deptAccess: person.deptAccess, + address: addr1 + }; + + return outputPersonList; +} + +function testReassignValueInLet() returns FullName[] { + + Student s1 = {firstName: "Alex", lastName: "George", score: 82.5}; + Student s2 = {firstName: "Ranjan", lastName: "Fonseka", score: 90.6}; + + Student[] studentList = [s1, s2]; + FullName[] nameList = []; + + var outputNameList = + from var student in studentList + let float twiceScore = (student.score * 2.0) + do { + twiceScore = 1000; + if (twiceScore < 50.00) { + FullName fullname = {firstName: student.firstName, lastName: student.lastName}; + nameList.push(fullname); + } + }; + + return outputNameList; +} + +function testQueryExprForString() returns string { + Person p1 = {firstName: "Alex", lastName: "George", age: 23}; + Person p2 = {firstName: "Ranjan", lastName: "Fonseka", age: 30}; + Person p3 = {firstName: "John", lastName: "David", age: 33}; + + Person[] personList = [p1, p2, p3]; + + string outputNameString = + from var person in personList + select person.age; + + return outputNameString; +} + +function testQueryExprForString2() returns string { + Person p1 = {firstName: "Alex", lastName: "George", age: 23}; + Person p2 = {firstName: "Ranjan", lastName: "Fonseka", age: 30}; + Person p3 = {firstName: "John", lastName: "David", age: 33}; + + Person[] personList = [p1, p2, p3]; + + string outputNameString = + from var person in personList + select { + firstName: person.firstName, + lastName: person.lastName + }; + + return outputNameString; +} + +function testQueryExprWithAmbigousTypeForXML() { + xml book1 = xml ` + Sherlock Holmes + Sir Arthur Conan Doyle + `; + + xml book2 = xml ` + The Da Vinci Code + Dan Brown + `; + + xml book = book1 + book2; + + xml|xml[] books = from var x in book/ + select x; + +} + +function testQueryExprWithAmbigousTypeForString() { + Person p1 = {firstName: "Alex", lastName: "George", age: 23}; + Person p2 = {firstName: "Ranjan", lastName: "Fonseka", age: 30}; + Person p3 = {firstName: "John", lastName: "David", age: 33}; + + Person[] personList = [p1, p2, p3]; + + string|string[] outputNameString = + from var person in personList + select person.firstName; +} + +type EmployeeEntity record { + int id; + string fname; + string lname; + int age; +}; + +type Employee record {| + string fname; + string lname; + int age; +|}; + +function testVariableShadowingWithQueryExpressions() { + string fname = ""; + EmployeeEntity[] entities = [ + {id: 1232, fname: "Sameera", lname: "Jayasoma", age: 30}, + {id: 1232, fname: "Asanthi", lname: "Kulasinghe", age: 30}, + {id: 1232, fname: "Khiana", lname: "Jayasoma", age: 2} + ]; + + Employee[] records = from var {fname, lname, age} in entities + select {fname, lname, age}; +} + +public function testMethodParamWithLet(int age) { + + Person p1 = {firstName: "Alex", lastName: "George", age: 23}; + Person p2 = {firstName: "Ranjan", lastName: "Fonseka", age: 30}; + Person p3 = {firstName: "John", lastName: "David", age: 33}; + + Person[] personList = [p1, p2, p3]; + + Person[] outputPersonList = + from var person in personList + let int age = 35 + select { + firstName: person.firstName, + lastName: person.lastName, + age: age + }; +} + +public function testMethodParamInQuery(int age) { + + Person p1 = {firstName: "Alex", lastName: "George", age: 23}; + Person p2 = {firstName: "Ranjan", lastName: "Fonseka", age: 30}; + Person p3 = {firstName: "John", lastName: "David", age: 33}; + + Person[] personList = [p1, p2, p3]; + + Person[] outputPersonList = + from var {firstName, lastName, age} in personList + select { + firstName: firstName, + lastName: lastName, + age: age + }; +} + +type TableRecord record { + readonly string name; + int id; +}; + +function testTableWithNonMappingType() { + + table key(name) t = table [ + {name: "Amy", id: 1234}, + {name: "John", id: 4567} + ]; + + table ids = from var x in t + select x.id; +} + +function testTableWithNonMappingTypeWithBindingPatterns() { + + table key(name) t = table [ + {name: "Amy", id: 1234}, + {name: "John", id: 4567} + ]; + + table ids = from var {id} in t + select id; +} + +public function testInvalidInputType() { + int x = 1; + int[] w = from var a in x + select 1; +} + +function testIncompatibleSelectType(stream clientStream) returns error? { + return stream from string num in clientStream + select {a: 1}; +} + +function testMapBindingPatternsAnydataType() { + map keyValsMap = {foo: "sss", bar: "ffff"}; + var x = map from var {k} in keyValsMap + select k; +} + +function testMapBindingPatternsAnyType() { + map keyValsMap = {foo: "sss", bar: "ffff"}; + var x = map from var {k} in keyValsMap + select k; +} + +type User record { + readonly int id; + readonly string firstName; + string lastName; + int age; +}; + +function testInvalidTypeInSelectWithQueryConstructingTable() { + User u1 = {id: 1, firstName: "John", lastName: "Doe", age: 25}; + User u2 = {id: 2, firstName: "Anne", lastName: "Frank", age: 30}; + + table key(id) users = table []; + users.add(u1); + users.add(u2); + + var result = table key(id) from var user in users + where user.age > 21 && user.age < 60 + select {user}; + + User[] userList = [u1, u2]; + result = table key(id) from var user in userList + where user.age > 21 && user.age < 60 + select {user}; +} + +function testInvalidTypeInSelectWithQueryConstructingTable2() { + User u1 = {id: 1, firstName: "John", lastName: "Doe", age: 25}; + User u2 = {id: 2, firstName: "Anne", lastName: "Frank", age: 30}; + + table key(id) users = table []; + users.add(u1); + users.add(u2); + + var result = table key(id, firstName) from var user in users + where user.age > 21 && user.age < 60 + select {user}; + + User[] userList = [u1, u2]; + result = table key(id, firstName) from var user in userList + where user.age > 21 && user.age < 60 + select {user}; +} + +type ScoreEvent readonly & record {| + string email; + string problemId; + float score; +|}; + +type ScoreEventType ScoreEvent; + +function testInvalidTypeInFromClause() { + ScoreEventType[] events = []; + + _ = from int ev in events + select ev; +} + +UndefinedType[] undefinedTypeList = []; + +public function testVariableOfUndefinedTypeUsedInFromClause() { + int[] _ = from var item in undefinedTypeList + select 1; +} + +int[] customerList = []; + +public function testVariableOfUndefinedTypeUsedInJoin() { + int[] _ = from var customer in customerList + join UndefinedType item in undefinedTypeList + on 1 equals 1 + select 1; +} + +function testInvalidTypeInOnConflictClauseWithQueryConstructingTable() { + User[] users = []; + error|int msg = error("Error"); + + var result1 = table key(id) from var user in users + where user.age > 21 && user.age < 60 + select {user} + on conflict 1; + + var result2 = table key(id) from var user in users + where user.age > 21 && user.age < 60 + select {user} + on conflict msg; +} + +function testQueryUsedAsFuncArg() { + int len = getLength(from string s in ["A", "B"] + select s); + + string[][] ar = []; + int[][] newAr = from var c in ar + select foo(from var s in c + select s.trim()); +} + +function getLength(int[] arr) returns int { + return arr.length(); +} + +function foo(int[] s) returns int[] { + return s; +} + +function testInvalidCheckExpressionInQueryAction() returns string|error { + from int _ in [1, 3, 5] + do { + check returnNil(); + return "string 1"; + }; + return "string 2"; +} + +function testInvalidCheckExpressionInQueryAction2() returns error? { + from int _ in [1, 3, 5] + do { + check returnNil(); + return; + }; + return; +} + +function returnNil() { +} + +type PersonA record {| + string firstName; + string lastName; + int age; +|}; + +type Persons PersonA[]; + +function testInvalidContextuallyExpectedTypes() { + + PersonA[] personList = []; + int outputPersonList = + from var person in + personList + let int newAge = 20 + where person.age == 33 + select person.firstName; + + Persons outputPersons = + from var person in personList + let int newAge = 20 + where person.age == 33 + select person.firstName; + + PersonA outputPerson = from var person in personList + let int newAge = 20 + where person.age == 33 + select person.firstName; +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/tabs-expected.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/tabs-expected.txt new file mode 100644 index 000000000000..9f17c933f336 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/tabs-expected.txt @@ -0,0 +1,40 @@ +ERROR [tabs.bal:(5:8,5:8)] missing function keyword (BCE0248) + | +5 | public function add(int a, int b) returns int { + | ++++++++ + +ERROR [tabs.bal:(8:9,8:9)] missing if keyword (BCE0262) + | +8 | } else if (b < 0) { + | ++ + +ERROR [tabs.bal:(14:8,14:8)] missing function keyword (BCE0248) + | +14 | public function sub(int a, int b) returns int { + | ++++++++ + +ERROR [tabs.bal:(24:41,24:41)] missing select keyword (BCE0231) + | +24 | int[] numsTimes10 = from var i in nums select i * 10; + | ++++++ + +ERROR [tabs.bal:(25:21,25:21)] missing from keyword (BCE0260) + | +25 | int[] numsTimes2 = from var i in nums select i * 2; + | ++++ + +ERROR [tabs.bal:(26:32,26:32)] missing in keyword (BCE0261) + | +26 | int[] numsTimes3 = from var i in nums select i * 3; + | ++ + +ERROR [tabs.bal:(27:42,27:42)] missing order keyword (BCE0266) + | +27 | int[] numsReversed = from int i in nums order by i descending select i; + | +++++ + +ERROR [tabs.bal:(28:49,28:49)] missing by keyword (BCE0267) + | +28 | int[] numsReversed_ = from int i in nums order by i descending select i; + | ++ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/tabs.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/tabs.bal new file mode 100644 index 000000000000..e4884bbc44e9 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/tabs.bal @@ -0,0 +1,30 @@ +public function main() { + +} + +public add(int a, int b) returns int { + if (a < 0) { + return 0; + } else (b < 0) { + return 0; + } + return a + b; +} + +public sub(int a, int b) returns int { + int count = 0; + while true { + count = count + 1; + } + return a - b; +} + +public function query() { + int[] nums = [1, 2, 3, 4]; + int[] numsTimes10 = from var i in nums i * 10; + int[] numsTimes2 = var i in nums select i * 2; + int[] numsTimes3 = from var i nums select i * 3; + int[] numsReversed = from int i in nums by i descending select i; + int[] numsReversed_ = from int i in nums order i descending select i; + +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/two-line-error-expected.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/two-line-error-expected.txt new file mode 100644 index 000000000000..1772be7a93d2 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/two-line-error-expected.txt @@ -0,0 +1,14 @@ +ERROR [two-line-error.bal:(2:45,3:18)] operator '+' not defined for 'int' and 'string' (BCE2070) + | +2 | int a = exponentiate(1 + 2 + 3 + 4 + 5, 3 + 4 + 5 + + | ^^^^^^^^^^^ +3 | "Hello world" + 6 + 7 + 8 + 9 + 10); + | ^^^^^^^^^^^^^^^^^ + +ERROR [two-line-error.bal:(17:13,18:29)] too many arguments in call to 'exponentiate()' (BCE2524) + | +17 | int d = exponentiate(2, 3 + | ^^^^^^^^^^^^^^^^^ +18 | , true, "Hello, World!"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/two-line-error.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/two-line-error.bal new file mode 100644 index 000000000000..f58d3a804568 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-error/two-line-error.bal @@ -0,0 +1,30 @@ +public function main() { + int a = exponentiate(1 + 2 + 3 + 4 + 5, 3 + 4 + 5 + + "Hello world" + 6 + 7 + 8 + 9 + 10); + // + // + // + // + // + // + // + // + // + // + // + // + + int d = exponentiate(2, 3 + , true, "Hello, World!"); +} + +public function exponentiate(int base, int exponent) returns int { + if (exponent == 0) { + return 1; + } + if (exponent % 2 == 0) { + int halfResult = exponentiate(base, exponent / 2); + return halfResult * halfResult; + } + return base * exponentiate(base, exponent - 1); +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-invalid-error/invalid-token-expected.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-invalid-error/invalid-token-expected.txt new file mode 100644 index 000000000000..82fad03e8d93 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-invalid-error/invalid-token-expected.txt @@ -0,0 +1,4 @@ +ERROR [invalid-token.bal:(3:16,3:17)] invalid token '=' (BCE0600) + | +3 | int b = 20;= + | ^ diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-invalid-error/invalid-token.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-invalid-error/invalid-token.bal new file mode 100644 index 000000000000..eea1f7760dd2 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-invalid-error/invalid-token.bal @@ -0,0 +1,5 @@ +public function main() { + int a = 10; + int b = 20;= + int c = a + b; +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-function-keyword-expected.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-function-keyword-expected.txt new file mode 100644 index 000000000000..1bae3ce48fcd --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-function-keyword-expected.txt @@ -0,0 +1,4 @@ +ERROR [missing-function-keyword.bal:(1:8,1:8)] missing function keyword (BCE0248) + | +1 | public function main() { + | ++++++++ diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-function-keyword.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-function-keyword.bal new file mode 100644 index 000000000000..1cadff02edc8 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-function-keyword.bal @@ -0,0 +1,3 @@ +public main() { + string a = "Hello Worl"; +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-multiple-keywords-expected.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-multiple-keywords-expected.txt new file mode 100644 index 000000000000..d138573c4534 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-multiple-keywords-expected.txt @@ -0,0 +1,40 @@ +ERROR [missing-multiple-keywords.bal:(5:8,5:8)] missing function keyword (BCE0248) + | +5 | public function add(int a, int b) returns int { + | ++++++++ + +ERROR [missing-multiple-keywords.bal:(8:12,8:12)] missing if keyword (BCE0262) + | +8 | } else if (b < 0) { + | ++ + +ERROR [missing-multiple-keywords.bal:(14:8,14:8)] missing function keyword (BCE0248) + | +14 | public function sub(int a, int b) returns int { + | ++++++++ + +ERROR [missing-multiple-keywords.bal:(24:44,24:44)] missing select keyword (BCE0231) + | +24 | int[] numsTimes10 = from var i in nums select i * 10; + | ++++++ + +ERROR [missing-multiple-keywords.bal:(25:24,25:24)] missing from keyword (BCE0260) + | +25 | int[] numsTimes2 = from var i in nums select i * 2; + | ++++ + +ERROR [missing-multiple-keywords.bal:(26:35,26:35)] missing in keyword (BCE0261) + | +26 | int[] numsTimes3 = from var i in nums select i * 3; + | ++ + +ERROR [missing-multiple-keywords.bal:(27:45,27:45)] missing order keyword (BCE0266) + | +27 | int[] numsReversed = from int i in nums order by i descending select i; + | +++++ + +ERROR [missing-multiple-keywords.bal:(28:52,28:52)] missing by keyword (BCE0267) + | +28 | int[] numsReversed_ = from int i in nums order by i descending select i; + | ++ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-multiple-keywords.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-multiple-keywords.bal new file mode 100644 index 000000000000..10079d424a10 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-multiple-keywords.bal @@ -0,0 +1,30 @@ +public function main() { + +} + +public add(int a, int b) returns int { + if (a < 0) { + return 0; + } else (b < 0) { + return 0; + } + return a + b; +} + +public sub(int a, int b) returns int { + int count = 0; + while true { + count = count + 1; + } + return a - b; +} + +public function query() { + int[] nums = [1, 2, 3, 4]; + int[] numsTimes10 = from var i in nums i * 10; + int[] numsTimes2 = var i in nums select i * 2; + int[] numsTimes3 = from var i nums select i * 3; + int[] numsReversed = from int i in nums by i descending select i; + int[] numsReversed_ = from int i in nums order i descending select i; + +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-non-terminal-expected.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-non-terminal-expected.txt new file mode 100644 index 000000000000..8a52f45ecd20 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-non-terminal-expected.txt @@ -0,0 +1,42 @@ +ERROR [missing-non-terminal.bal:(1:12,1:13)] missing enum member (BCE0507) + | +1 | enum Color { + | ^ + +ERROR [missing-non-terminal.bal:(5:9,5:9)] missing identifier (BCE0400) + | +5 | int = 5; + | ^ + +ERROR [missing-non-terminal.bal:(6:12,6:12)] missing identifier (BCE0400) + | +6 | string = "Hello"; + | ^ + +ERROR [missing-non-terminal.bal:(9:9,10:13)] missing select clause (BCE0503) + | + 9 | where i % 2 + | ^^^^^^^^^^^ +10 | == 0 + | ^^^^^^^^^^^^ + +ERROR [missing-non-terminal.bal:(15:17,15:17)] missing function name (BCE0500) + | +15 | public function (int num1, int num2) returns int { + | ^ + +ERROR [missing-non-terminal.bal:(19:31,19:35)] unknown type 'num2' (BCE2069) + | +19 | public function mul(int num1, num2 ) returns int { + | ^^^^ + +ERROR [missing-non-terminal.bal:(19:36,19:36)] missing identifier (BCE0400) + | +19 | public function mul(int num1, num2 ) returns int { + | ^ + +ERROR [missing-non-terminal.bal:(20:19,20:23)] undefined symbol 'num2' (BCE2010) + | +20 | return num1 * num2; + | ^^^^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-non-terminal.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-non-terminal.bal new file mode 100644 index 000000000000..a84e5f10e0ce --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-non-terminal.bal @@ -0,0 +1,21 @@ +enum Color { +} + +public function main() { + int = 5; + string = "Hello"; + int[] nums = [1, 2, 3, 4]; + int[] evenNums = from int i in nums + where i % 2 + == 0 + ; + +} + +public function (int num1, int num2) returns int { + return num1 + num2; +} + +public function mul(int num1, num2 ) returns int { + return num1 * num2; +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-token-padding-expected.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-token-padding-expected.txt new file mode 100644 index 000000000000..24c2958842d1 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/missing-token-padding-expected.txt @@ -0,0 +1,4 @@ +ERROR [missing-function-keyword.bal:(1:8,1:8)] missing function keyword (BCE0248) + | +1 | public function main() { + | ++++++++ diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/semicolon-missing-expected.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/semicolon-missing-expected.txt new file mode 100644 index 000000000000..5d0b0099b069 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/semicolon-missing-expected.txt @@ -0,0 +1,4 @@ +ERROR [semicolon-missing.bal:(5:1,5:1)] missing semicolon token (BCE0002) + | +5 | ; return; + | + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/semicolon-missing.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/semicolon-missing.bal new file mode 100644 index 000000000000..41c88fa2d9b7 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-missing-error/semicolon-missing.bal @@ -0,0 +1,6 @@ +public function main(string... str) { + + // Following line is invalid. + int b + return; +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/.gitignore b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/.gitignore new file mode 100644 index 000000000000..3749d15ac361 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/.gitignore @@ -0,0 +1,4 @@ +target +generated +Config.toml +Dependencies.toml diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/Ballerina.toml b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/Ballerina.toml new file mode 100644 index 000000000000..95e1990c2c6f --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/Ballerina.toml @@ -0,0 +1,5 @@ +[package] +org = "testdig" +name = "project1" +version = "0.1.0" +distribution = "2201.8.4" diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/main.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/main.bal new file mode 100644 index 000000000000..f385f6590e92 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/main.bal @@ -0,0 +1,13 @@ +import asfasdf/adsfadsf; +import project1.util; + +public function main() { + int a = 1; + string b = string `Hello ${a}`; + io:println("Hello, World!"); + io::println(util:hello(b)); + +} +test() { + return; +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/helpers/helpers.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/helpers/helpers.bal new file mode 100644 index 000000000000..1ed502e81e0d --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/helpers/helpers.bal @@ -0,0 +1,9 @@ +# Returns the string `Hello` with the input string name. +# +# + name - name as a string +# + return - "Hello, " with the input string name +public function hello2(string name) returns string { + if !(name is "") { + return "Hello, " + name; + } + return "Hello, World!"; diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/helpers/tests/lib_test.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/helpers/tests/lib_test.bal new file mode 100644 index 000000000000..1c84bf966436 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/helpers/tests/lib_test.bal @@ -0,0 +1,19 @@ +import ballerina/test; + +// Test function + +@test:Config {} +function testFunction() { + string name = "John"; + string welcomeMsg = hello2(name); + test:assertEquals("Hello, John", welcomeMsg); +} + +// Negative Test function + +@test:Config {} +function negativeTestFunction() { + name = ""; + string welcomeMsg = hello2(name); + test:assertEquals("Hello, World!", welcomeMsg); +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/util/docalc.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/util/docalc.bal new file mode 100644 index 000000000000..c07ca82dc7d4 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/util/docalc.bal @@ -0,0 +1,3 @@ +public function doACalc() returns int{ + return 1 10; +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/util/person.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/util/person.bal new file mode 100644 index 000000000000..54569d530622 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/util/person.bal @@ -0,0 +1,4 @@ +type Person record {| + string name; + int age; +|}; diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/util/tests/lib_test.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/util/tests/lib_test.bal new file mode 100644 index 000000000000..aaa2a2c5bb76 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/util/tests/lib_test.bal @@ -0,0 +1,18 @@ +import ballerina/test; + +@test:Config {} +function testFunction() { + string name = "John"; + string welcomeMsg = hello(name); + test:assertEquals("Hello, John", welcomeMsg); +} + +// Negative Test function + +@test:Config {} +function negativeTestFunction() { + string name = ""; + string welcomeMsg = hello(name); + test:assertEquals("Hello, World!", welcomeMsg); +} + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/util/util.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/util/util.bal new file mode 100644 index 000000000000..512727034b46 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project1/modules/util/util.bal @@ -0,0 +1,14 @@ +import project1.helpers; + +# Returns the string `Hello` with the input string name. +# +# + name - name as a string +# + return - "Hello, " with the input string name +public function hello(string name) returns string { + if !(name is "") { + Person person = {name: name, age: 10}; + return string `Hello, ${person.name}! You are ${person.age.toString()} years old. ${doACalc().toString()}`; + } + + return "Hello, World!" + helpers:hello2("John"); +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project2/.gitignore b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project2/.gitignore new file mode 100644 index 000000000000..3749d15ac361 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project2/.gitignore @@ -0,0 +1,4 @@ +target +generated +Config.toml +Dependencies.toml diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project2/Ballerina.toml b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project2/Ballerina.toml new file mode 100644 index 000000000000..68a164cdecbc --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project2/Ballerina.toml @@ -0,0 +1,8 @@ +[package] +org = "testdig" +name = "project2" +version = "0.1.0" +distribution = "2201.8.4" + +[build-options] +observabilityIncluded = true diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project2/main.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project2/main.bal new file mode 100644 index 000000000000..ec9e8359d5da --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project2/main.bal @@ -0,0 +1,35 @@ +import project2.mymath; + +service / on new Listener() { + + resource function get greeting() returns string { + return "Hello, World!"; + } + + resource function get add(int a, int b) returns int { + return mymath:add(a, b); + } + + resource function get subtract(int a, int b) returns int { + return mymath:subtract(a, b); + } + +} + +public class Listener { + public isolated function 'start() returns error? { + return; + } + public isolated function gracefulStop() returns error? { + return; + } + public isolated function immediateStop() returns error? { + return; + } + public isolated function detach(service object {} s) returns error? { + return; + } + public isolated function attach(service object {} s, string[]|string? name = ()) returns error? { + return; + } +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project2/modules/mymath/mymath.bal b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project2/modules/mymath/mymath.bal new file mode 100644 index 000000000000..fbbbe6507c9a --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/project2/modules/mymath/mymath.bal @@ -0,0 +1,13 @@ +public function add(int a, int b) returns int { + return a + b; +} + +# Description. +# +# + a - parameter description +# + a - parameter description +# + c - parameter description +# + return - return value description +public function subtract(int a, int b) returns int { + return a - b; +} diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/unix/project1-expected.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/unix/project1-expected.txt new file mode 100644 index 000000000000..567568cf8090 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/unix/project1-expected.txt @@ -0,0 +1,55 @@ +ERROR [modules/helpers/helpers.bal:(10:1,10:1)] missing close brace token (BCE0007) + | +10 | } + | + + +ERROR [modules/helpers/tests/lib_test.bal:(16:5,16:9)] undefined symbol 'name' (BCE2010) + | +16 | name = ""; + | ^^^^ + +ERROR [modules/helpers/tests/lib_test.bal:(17:32,17:36)] undefined symbol 'name' (BCE2010) + | +17 | string welcomeMsg = hello2(name); + | ^^^^ + +ERROR [modules/util/docalc.bal:(2:14,2:14)] missing binary operator (BCE0012) + | +2 | return 1 + 10; + | + + +ERROR [main.bal:(1:1,1:25)] cannot resolve module 'asfasdf/adsfadsf' (BCE2003) + | +1 | import asfasdf/adsfadsf; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +ERROR [main.bal:(7:5,7:32)] undefined function 'println' (BCE2011) + | +7 | io:println("Hello, World!"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +ERROR [main.bal:(7:5,7:32)] undefined module 'io' (BCE2000) + | +7 | io:println("Hello, World!"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +ERROR [main.bal:(8:5,8:31)] undefined function 'println' (BCE2011) + | +8 | io::println(util:hello(b)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +ERROR [main.bal:(8:5,8:31)] undefined module 'io' (BCE2000) + | +8 | io::println(util:hello(b)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +ERROR [main.bal:(8:7,8:8)] invalid token ':' (BCE0600) + | +8 | io::println(util:hello(b)); + | ^ + +ERROR [main.bal:(11:1,11:1)] missing function keyword (BCE0248) + | +11 | function test() { + | ++++++++ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/unix/project2-expected-hints.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/unix/project2-expected-hints.txt new file mode 100644 index 000000000000..ad5a0d95e6a5 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/unix/project2-expected-hints.txt @@ -0,0 +1,10 @@ +HINT [main.bal:(9:5,9:5)] concurrent calls will not be made to this method since the method is not an 'isolated' method (BCH2005) + | +9 | resource function get add(int a, int b) returns int { + | ^ + +HINT [main.bal:(13:5,13:5)] concurrent calls will not be made to this method since the method is not an 'isolated' method (BCH2005) + | +13 | resource function get subtract(int a, int b) returns int { + | ^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/unix/project2-expected-warnings.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/unix/project2-expected-warnings.txt new file mode 100644 index 000000000000..d758dde0171e --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/unix/project2-expected-warnings.txt @@ -0,0 +1,15 @@ +WARNING [modules/mymath/mymath.bal:(8:5,8:6)] parameter 'a' already documented (BCE20003) + | +8 | # + a - parameter description + | ^ + +WARNING [modules/mymath/mymath.bal:(9:5,9:6)] no such documentable parameter 'c' (BCE20002) + | +9 | # + c - parameter description + | ^ + +WARNING [modules/mymath/mymath.bal:(11:33,11:38)] undocumented parameter 'b' (BCE20001) + | +11 | public function subtract(int a, int b) returns int { + | ^^^^^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/windows/project1-expected.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/windows/project1-expected.txt new file mode 100644 index 000000000000..096cdad565d8 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/windows/project1-expected.txt @@ -0,0 +1,55 @@ +ERROR [modules\helpers\helpers.bal:(10:1,10:1)] missing close brace token (BCE0007) + | +10 | } + | + + +ERROR [modules\helpers\tests\lib_test.bal:(16:5,16:9)] undefined symbol 'name' (BCE2010) + | +16 | name = ""; + | ^^^^ + +ERROR [modules\helpers\tests\lib_test.bal:(17:32,17:36)] undefined symbol 'name' (BCE2010) + | +17 | string welcomeMsg = hello2(name); + | ^^^^ + +ERROR [modules\util\docalc.bal:(2:14,2:14)] missing binary operator (BCE0012) + | +2 | return 1 + 10; + | + + +ERROR [main.bal:(1:1,1:25)] cannot resolve module 'asfasdf/adsfadsf' (BCE2003) + | +1 | import asfasdf/adsfadsf; + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +ERROR [main.bal:(7:5,7:32)] undefined function 'println' (BCE2011) + | +7 | io:println("Hello, World!"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +ERROR [main.bal:(7:5,7:32)] undefined module 'io' (BCE2000) + | +7 | io:println("Hello, World!"); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +ERROR [main.bal:(8:5,8:31)] undefined function 'println' (BCE2011) + | +8 | io::println(util:hello(b)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +ERROR [main.bal:(8:5,8:31)] undefined module 'io' (BCE2000) + | +8 | io::println(util:hello(b)); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +ERROR [main.bal:(8:7,8:8)] invalid token ':' (BCE0600) + | +8 | io::println(util:hello(b)); + | ^ + +ERROR [main.bal:(11:1,11:1)] missing function keyword (BCE0248) + | +11 | function test() { + | ++++++++ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/windows/project2-expected-hints.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/windows/project2-expected-hints.txt new file mode 100644 index 000000000000..826f7c83906c --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/windows/project2-expected-hints.txt @@ -0,0 +1,15 @@ +WARNING [modules\mymath\mymath.bal:(8:5,8:6)] parameter 'a' already documented (BCE20003) + | +8 | # + a - parameter description + | ^ + +WARNING [modules\mymath\mymath.bal:(9:5,9:6)] no such documentable parameter 'c' (BCE20002) + | +9 | # + c - parameter description + | ^ + +WARNING [modules\mymath\mymath.bal:(11:33,11:38)] undocumented parameter 'b' (BCE20001) + | +11 | public function subtract(int a, int b) returns int { + | ^^^^^ + diff --git a/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/windows/project2-expected-warnings.txt b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/windows/project2-expected-warnings.txt new file mode 100644 index 000000000000..ad5a0d95e6a5 --- /dev/null +++ b/cli/ballerina-cli/src/test/resources/test-resources/diagnostics-test-files/bal-project-error/windows/project2-expected-warnings.txt @@ -0,0 +1,10 @@ +HINT [main.bal:(9:5,9:5)] concurrent calls will not be made to this method since the method is not an 'isolated' method (BCH2005) + | +9 | resource function get add(int a, int b) returns int { + | ^ + +HINT [main.bal:(13:5,13:5)] concurrent calls will not be made to this method since the method is not an 'isolated' method (BCH2005) + | +13 | resource function get subtract(int a, int b) returns int { + | ^ + diff --git a/cli/ballerina-cli/src/test/resources/testng.xml b/cli/ballerina-cli/src/test/resources/testng.xml index 2b477f334530..171999230815 100644 --- a/cli/ballerina-cli/src/test/resources/testng.xml +++ b/cli/ballerina-cli/src/test/resources/testng.xml @@ -20,6 +20,11 @@ under the License. + + + + + diff --git a/compiler/ballerina-lang/src/main/java/module-info.java b/compiler/ballerina-lang/src/main/java/module-info.java index b76856e09d11..4865bd4d49bf 100644 --- a/compiler/ballerina-lang/src/main/java/module-info.java +++ b/compiler/ballerina-lang/src/main/java/module-info.java @@ -77,7 +77,7 @@ exports io.ballerina.projects.plugins.codeaction; exports io.ballerina.projects.internal.model; // TODO Remove this exports exports io.ballerina.projects.internal.environment; // TODO Remove these exports - exports io.ballerina.projects.internal to io.ballerina.cli; + exports io.ballerina.projects.internal to io.ballerina.cli, io.ballerina.shell.cli; exports io.ballerina.projects.internal.bala; exports io.ballerina.projects.internal.configschema to org.ballerinalang.config.schema.generator, io.ballerina.language.server.core; diff --git a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/diagnostics/StringDiagnosticProperty.java b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/diagnostics/StringDiagnosticProperty.java new file mode 100644 index 000000000000..2f7bda466e2a --- /dev/null +++ b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/diagnostics/StringDiagnosticProperty.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package io.ballerina.compiler.internal.diagnostics; + +import io.ballerina.tools.diagnostics.DiagnosticProperty; +import io.ballerina.tools.diagnostics.DiagnosticPropertyKind; + +import java.util.Arrays; + +/** + * Represents a string diagnostic property. + * + * @since 2201.10.0 + */ +public class StringDiagnosticProperty implements DiagnosticProperty { + + private final DiagnosticPropertyKind kind; + private final String value; + + public StringDiagnosticProperty(String value) { + this.kind = DiagnosticPropertyKind.STRING; + this.value = value; + } + + @Override + public DiagnosticPropertyKind kind() { + return kind; + } + + @Override + public String value() { + return value; + } + + @Override + public int hashCode() { + return Arrays.hashCode(new int[]{kind.hashCode(), value.hashCode()}); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof StringDiagnosticProperty prop) { + return this.value.equals(prop.value) && this.kind.equals(prop.kind); + } + return false; + } +} diff --git a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/diagnostics/SyntaxDiagnostic.java b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/diagnostics/SyntaxDiagnostic.java index 1ae9489efe9b..ac75ed6bf8e8 100644 --- a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/diagnostics/SyntaxDiagnostic.java +++ b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/diagnostics/SyntaxDiagnostic.java @@ -24,6 +24,7 @@ import io.ballerina.tools.diagnostics.DiagnosticInfo; import io.ballerina.tools.diagnostics.DiagnosticProperty; +import java.util.ArrayList; import java.util.List; /** @@ -32,6 +33,7 @@ * @since 2.0.0 */ public class SyntaxDiagnostic extends Diagnostic { + private final STNodeDiagnostic nodeDiagnostic; private final NodeLocation location; private DiagnosticInfo diagnosticInfo; @@ -74,7 +76,13 @@ public String message() { @Override public List> properties() { - return null; + Object[] args = this.nodeDiagnostic.args(); + List> diagArgs = new ArrayList<>(); + for (Object arg : args) { + DiagnosticProperty dArg = new StringDiagnosticProperty((String) arg); + diagArgs.add(dArg); + } + return diagArgs; } @Override diff --git a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/SyntaxErrors.java b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/SyntaxErrors.java index 16bea2db962f..18d85fd1da15 100644 --- a/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/SyntaxErrors.java +++ b/compiler/ballerina-parser/src/main/java/io/ballerina/compiler/internal/parser/SyntaxErrors.java @@ -93,7 +93,7 @@ public static STToken createMissingRegExpTokenWithDiagnostics(SyntaxKind expecte public static STToken createMissingTokenWithDiagnostics(SyntaxKind expectedKind, DiagnosticCode diagnosticCode) { List diagnosticList = new ArrayList<>(); - diagnosticList.add(createDiagnostic(diagnosticCode)); + diagnosticList.add(createDiagnostic(diagnosticCode, expectedKind.stringValue())); return STNodeFactory.createMissingToken(expectedKind, diagnosticList); } diff --git a/compiler/ballerina-parser/src/main/java/module-info.java b/compiler/ballerina-parser/src/main/java/module-info.java index 2d0455b39c5f..8b4751616496 100644 --- a/compiler/ballerina-parser/src/main/java/module-info.java +++ b/compiler/ballerina-parser/src/main/java/module-info.java @@ -2,4 +2,5 @@ requires io.ballerina.tools.api; exports io.ballerina.compiler.syntax.tree; exports io.ballerina.compiler.internal.parser.tree to io.ballerina.lang; + exports io.ballerina.compiler.internal.diagnostics; } diff --git a/gradle.properties b/gradle.properties index eed4c3e7bb45..ee34c9b80df3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -92,7 +92,7 @@ jetbrainsKotlinStdlibVersion=1.6.0 jetbrainsKotlinStdlibCommonVersion=1.6.0 junitVersion=4.13.2 jknackHandlebarsVersion=4.0.6 -jlineVersion=3.23.0 +jlineVersion=3.25.0 jvnetMimepullVersion=1.9.11 kaitaiGradlePluginVersion=0.1.1 kaitaiStructRuntimeVersion=0.9 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAnnotationAccess.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAnnotationAccess.txt index 02c08213122d..4ef4fde9bff1 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAnnotationAccess.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAnnotationAccess.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertBehavioralTypes.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertBehavioralTypes.txt index a3dcd6542fd6..b87c8673ad6b 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertBehavioralTypes.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertBehavioralTypes.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertDiffError.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertDiffError.txt index 0fcb0d60b75a..ee89582e0934 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertDiffError.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertDiffError.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertStructuralTypes.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertStructuralTypes.txt index f59d2f7c166a..956c40b9ef85 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertStructuralTypes.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertStructuralTypes.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertionErrorMessage.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertionErrorMessage.txt index 753c7d8f0ee6..bd84674ed373 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertionErrorMessage.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/BasicCasesTest-testAssertionErrorMessage.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testArrayDataProviderWithFail.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testArrayDataProviderWithFail.txt index 177fa1d3e46e..3d03621893e4 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testArrayDataProviderWithFail.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testArrayDataProviderWithFail.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testArrayDataRerunFailedTest.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testArrayDataRerunFailedTest.txt index 62de71b0190f..e70563bca2bb 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testArrayDataRerunFailedTest.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testArrayDataRerunFailedTest.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys0.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys0.txt index 9b035dfe4df4..816d5e26120f 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys0.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys0.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys1.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys1.txt index 8c1f43d82d81..fa9f75198c97 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys1.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys1.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys2.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys2.txt index eb05990fbbec..0543c335188b 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys2.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys2.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys3.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys3.txt index 6b4ff813f0de..50282f7c5875 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys3.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys3.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys4.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys4.txt index 4fc7adcb9550..35d802bc7d8d 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys4.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys4.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys5.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys5.txt index 862b310dad79..62596538312b 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys5.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys5.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys6.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys6.txt index d2f21152b6d0..f87475fa8370 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys6.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeys6.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard0.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard0.txt index 9b035dfe4df4..816d5e26120f 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard0.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard0.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard1.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard1.txt index 8c1f43d82d81..fa9f75198c97 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard1.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard1.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard2.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard2.txt index eb05990fbbec..0543c335188b 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard2.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard2.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard3.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard3.txt index 6b4ff813f0de..50282f7c5875 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard3.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard3.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard4.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard4.txt index 4fc7adcb9550..35d802bc7d8d 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard4.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard4.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard5.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard5.txt index 862b310dad79..62596538312b 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard5.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard5.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard6.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard6.txt index d2f21152b6d0..f87475fa8370 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard6.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testCodeFragmentKeysWithWildCard6.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testDataProviderSingleFailure.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testDataProviderSingleFailure.txt index d62f56be1247..e87dfc583495 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testDataProviderSingleFailure.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testDataProviderSingleFailure.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testDataProviderWithMixedType.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testDataProviderWithMixedType.txt index 00c8194d9eb5..ef0ea94734a6 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testDataProviderWithMixedType.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testDataProviderWithMixedType.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testMapValueDataProvider.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testMapValueDataProvider.txt index c38947ff799c..25f294a5d2b7 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testMapValueDataProvider.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testMapValueDataProvider.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testMultiModuleSingleTestExec.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testMultiModuleSingleTestExec.txt index 6a8d9414dffe..675cdae0f9ee 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testMultiModuleSingleTestExec.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testMultiModuleSingleTestExec.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testRerunFailedTest.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testRerunFailedTest.txt index c7cc860df0bb..5cf32b5d9e18 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testRerunFailedTest.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testRerunFailedTest.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProvider.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProvider.txt index f6605f0a17ac..e7fa9ca3e556 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProvider.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProvider.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderCase.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderCase.txt index 939dee9ded10..3d9b46e2bd04 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderCase.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderCase.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithAfterFailing.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithAfterFailing.txt index 08cc2ccfe028..c8e8b7d4dc63 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithAfterFailing.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithAfterFailing.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithBeforeAfterFunctions.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithBeforeAfterFunctions.txt index 855b559c3d3e..9a7059f90c3e 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithBeforeAfterFunctions.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithBeforeAfterFunctions.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithBeforeFailing.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithBeforeFailing.txt index 20664b5932b5..bd70ce68ff40 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithBeforeFailing.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithBeforeFailing.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithFail.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithFail.txt index 53d541178839..9cfa047ea720 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithFail.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testValidDataProviderWithFail.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testWithSpecialKeys.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testWithSpecialKeys.txt index 3a19cdfe1337..fdd0da4f6bc0 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testWithSpecialKeys.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/DataProviderTest-testWithSpecialKeys.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/GroupingTest-testWhenAfterGroupsFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/GroupingTest-testWhenAfterGroupsFails.txt index 226cf4ea32af..91eb916ee41a 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/GroupingTest-testWhenAfterGroupsFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/GroupingTest-testWhenAfterGroupsFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source failed-after-groups-test.bal -WARNING [failed-after-groups-test.bal:(37:5,37:17)] unused variable 'b' +WARNING [failed-after-groups-test.bal:(37:5,37:17)] unused variable 'b' (BCE20403) + | +37 | int b = 2/0; + | ^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testEmptyDataProvider.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testEmptyDataProvider.txt index 0c0ac9e5321a..906ce0a1098d 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testEmptyDataProvider.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testEmptyDataProvider.txt @@ -2,5 +2,9 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source empty-data-provider-test.bal -ERROR [empty-data-provider-test.bal:(14:19,14:28)] incompatible types: expected 'function () returns (ballerina/test:0.0.0:DataProviderReturnType)?', found 'function () returns (int[])' +ERROR [empty-data-provider-test.bal:(14:19,14:28)] incompatible types: expected 'function () returns (ballerina/test:0.0.0:DataProviderReturnType)?', found 'function () returns (int[])' (BCE2066) + | +14 | dataProvider: provider2 + | ^^^^^^^^^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider.txt index d3a8749e72fe..4dfa9a60ae12 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source invalid-data-provider-test.bal -WARNING [invalid-data-provider-test.bal:(25:5,25:58)] unused variable 'resultErr' +WARNING [invalid-data-provider-test.bal:(25:5,25:58)] unused variable 'resultErr' (BCE20403) + | +25 | int|error resultErr = trap result.cloneWithType(int); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider2.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider2.txt index c80c73073bb0..fd147229e42b 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider2.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidDataProviderTestCase-testInvalidDataProvider2.txt @@ -2,9 +2,21 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source invalid-data-provider-test2.bal -WARNING [invalid-data-provider-test2.bal:(25:5,25:53)] unused variable 'fErr' -WARNING [invalid-data-provider-test2.bal:(26:5,26:53)] unused variable 'sErr' -WARNING [invalid-data-provider-test2.bal:(27:5,27:58)] unused variable 'resultErr' +WARNING [invalid-data-provider-test2.bal:(25:5,25:53)] unused variable 'fErr' (BCE20403) + | +25 | int|error fErr = trap fValue.cloneWithType(int); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [invalid-data-provider-test2.bal:(26:5,26:53)] unused variable 'sErr' (BCE20403) + | +26 | int|error sErr = trap sValue.cloneWithType(int); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [invalid-data-provider-test2.bal:(27:5,27:58)] unused variable 'resultErr' (BCE20403) + | +27 | int|error resultErr = trap result.cloneWithType(int); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInNonExistingModule.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInNonExistingModule.txt index a3c34b85eb58..aadc06b9a3e6 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInNonExistingModule.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInNonExistingModule.txt @@ -1,4 +1,12 @@ Compiling source intg_tests/non_existent_module_mock:0.1.0 ERROR [tests/test.bal:(3:1,6:2)] could not find specified module 'intg_tests/module1:0.1.0' + | +3 | @test:Mock { +: | ^^^^^^^^^^^^ +: | : +: | : +6 | } + | ^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInSingleFileProject.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInSingleFileProject.txt index 00aa19d721a0..c69f652d5818 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInSingleFileProject.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInSingleFileProject.txt @@ -3,4 +3,8 @@ warning: ignoring --includes flag since code coverage is not enabled Compiling source function-legacy-mock.bal ERROR [function-legacy-mock.bal:(8:1,8:38)] function mocking is not supported with standalone Ballerina files + | +8 | @test:Mock { functionName: "intAdd" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingFunctionWithIncompatibleTypes.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingFunctionWithIncompatibleTypes.txt index f4a01e5ecba0..434540575a3d 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingFunctionWithIncompatibleTypes.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingFunctionWithIncompatibleTypes.txt @@ -1,4 +1,12 @@ Compiling source intg_tests/incompatible_type_mock:0.1.0 ERROR [tests/test.bal:(6:1,8:2)] incompatible types: expected isolated function () returns (string) but found isolated function () returns (int) + | +6 | function getMockClient() returns int { +: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +: | : +: | : +8 | } + | ^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingNonExistingFunction.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingNonExistingFunction.txt index 327839ef5180..3d1c088b0ab8 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingNonExistingFunction.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingNonExistingFunction.txt @@ -1,4 +1,12 @@ Compiling source intg_tests/non_existent_function_mock:0.1.0 ERROR [tests/test.bal:(3:1,5:2)] could not find function 'createJdbcClient' in module 'intg_tests/non_existent_function_mock:0.1.0' + | +3 | @test:Mock { +: | ^^^^^^^^^^^^ +: | : +: | : +5 | } + | ^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingWithEmptyAnnotationRecord.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingWithEmptyAnnotationRecord.txt index 100d89c93610..a2196d1c87ac 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingWithEmptyAnnotationRecord.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingWithEmptyAnnotationRecord.txt @@ -1,4 +1,8 @@ Compiling source intg_tests/empty_annot_rec_function_mock:0.1.0 ERROR [tests/test.bal:(3:1,3:14)] function name cannot be empty + | +3 | @test:Mock {} + | ^^^^^^^^^^^^^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingWithoutAnnotationRecord.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingWithoutAnnotationRecord.txt index 3afce0b0f7d5..dc5115c7699d 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingWithoutAnnotationRecord.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testLegacyMockingWithoutAnnotationRecord.txt @@ -1,4 +1,8 @@ Compiling source intg_tests/recordless_annot_function_mock:0.1.0 ERROR [tests/test.bal:(3:1,3:11)] missing required 'functionName' field + | +3 | @test:Mock + | ^^^^^^^^^^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingFunctionInNonExistingModule.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingFunctionInNonExistingModule.txt index a3c34b85eb58..aadc06b9a3e6 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingFunctionInNonExistingModule.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingFunctionInNonExistingModule.txt @@ -1,4 +1,12 @@ Compiling source intg_tests/non_existent_module_mock:0.1.0 ERROR [tests/test.bal:(3:1,6:2)] could not find specified module 'intg_tests/module1:0.1.0' + | +3 | @test:Mock { +: | ^^^^^^^^^^^^ +: | : +: | : +6 | } + | ^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingFunctionInSingleFileProject.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingFunctionInSingleFileProject.txt index b07583365de3..ead4c3aaa0b4 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingFunctionInSingleFileProject.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingFunctionInSingleFileProject.txt @@ -3,4 +3,8 @@ warning: ignoring --includes flag since code coverage is not enabled Compiling source function-mock.bal ERROR [function-mock.bal:(12:1,12:38)] function mocking is not supported with standalone Ballerina files + | +12 | @test:Mock { functionName: "intAdd" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingNonExistingFunction.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingNonExistingFunction.txt index 6e8c9fa30bf2..7a7bddbfefee 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingNonExistingFunction.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingNonExistingFunction.txt @@ -1,4 +1,8 @@ Compiling source intg_tests/non_existent_function_mock:0.1.0 ERROR [tests/test.bal:(3:1,3:38)] could not find function 'intAdd' in module 'intg_tests/non_existent_function_mock:0.1.0' + | +3 | @test:Mock { functionName: "intAdd" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingWithEmptyAnnotationRecord.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingWithEmptyAnnotationRecord.txt index 100d89c93610..a2196d1c87ac 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingWithEmptyAnnotationRecord.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingWithEmptyAnnotationRecord.txt @@ -1,4 +1,8 @@ Compiling source intg_tests/empty_annot_rec_function_mock:0.1.0 ERROR [tests/test.bal:(3:1,3:14)] function name cannot be empty + | +3 | @test:Mock {} + | ^^^^^^^^^^^^^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingWithoutAnnotationRecord.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingWithoutAnnotationRecord.txt index 3afce0b0f7d5..dc5115c7699d 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingWithoutAnnotationRecord.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/InvalidFunctionMockingTestCase-testMockingWithoutAnnotationRecord.txt @@ -1,4 +1,8 @@ Compiling source intg_tests/recordless_annot_function_mock:0.1.0 ERROR [tests/test.bal:(3:1,3:11)] missing required 'functionName' field + | +3 | @test:Mock + | ^^^^^^^^^^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MissingFunctionsTestCase-testMissingAfterFunction.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MissingFunctionsTestCase-testMissingAfterFunction.txt index 464421053c58..a6f0eddbd0bb 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MissingFunctionsTestCase-testMissingAfterFunction.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MissingFunctionsTestCase-testMissingAfterFunction.txt @@ -2,5 +2,9 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source after-func-negative.bal -ERROR [after-func-negative.bal:(22:12,22:29)] undefined symbol 'afterFuncNonExist' +ERROR [after-func-negative.bal:(22:12,22:29)] undefined symbol 'afterFuncNonExist' (BCE2010) + | +22 | after: afterFuncNonExist + | ^^^^^^^^^^^^^^^^^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MissingFunctionsTestCase-testMissingBeforeFunction.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MissingFunctionsTestCase-testMissingBeforeFunction.txt index fb6158642878..cc3992ab5eff 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MissingFunctionsTestCase-testMissingBeforeFunction.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MissingFunctionsTestCase-testMissingBeforeFunction.txt @@ -2,5 +2,9 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source before-func-negative.bal -ERROR [before-func-negative.bal:(22:13,22:31)] undefined symbol 'beforeFuncNonExist' +ERROR [before-func-negative.bal:(22:13,22:31)] undefined symbol 'beforeFuncNonExist' (BCE2010) + | +22 | before: beforeFuncNonExist + | ^^^^^^^^^^^^^^^^^^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MissingFunctionsTestCase-testMissingDependsOnFunction.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MissingFunctionsTestCase-testMissingDependsOnFunction.txt index 3f4da62dcc4c..0ea72c1ffb68 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MissingFunctionsTestCase-testMissingDependsOnFunction.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MissingFunctionsTestCase-testMissingDependsOnFunction.txt @@ -2,5 +2,9 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source depends-on-negative.bal -ERROR [depends-on-negative.bal:(22:17,22:28)] undefined symbol 'nonExisting' +ERROR [depends-on-negative.bal:(22:17,22:28)] undefined symbol 'nonExisting' (BCE2010) + | +22 | dependsOn: [nonExisting] + | ^^^^^^^^^^^ + error: compilation contains errors \ No newline at end of file diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking.txt index 9963be3a446b..caaae019983f 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases1.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases1.txt index b3e2198b0cb7..92e606037a4a 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases1.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases1.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases2.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases2.txt index f291d70eb35a..8b969c6c541a 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases2.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases2.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases3.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases3.txt index a369bbedc170..4a4eb857f560 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases3.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases3.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases4.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases4.txt index 844d5d413b09..084e4d51d184 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases4.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases4.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases5.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases5.txt index d8ac4b000730..3ca6ca899c71 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases5.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases5.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases6.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases6.txt index 9b7effbf3202..b2fd79f44844 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases6.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases6.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases7.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases7.txt index 8b89ee8e229e..c6e52eea48e3 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases7.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/MockTest-testObjectMocking_NegativeCases7.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules/TestHttpClient/main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenAfterEachFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenAfterEachFails.txt index 594604459e03..d13a959c6229 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenAfterEachFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenAfterEachFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source skip-when-afterEach-fails.bal -WARNING [skip-when-afterEach-fails.bal:(30:5,30:18)] unused variable 'i' +WARNING [skip-when-afterEach-fails.bal:(30:5,30:18)] unused variable 'i' (BCE20403) + | +30 | int i = 12/0; + | ^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenAfterFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenAfterFails.txt index 5ca3d5a1e622..971f80e9c500 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenAfterFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenAfterFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source skip-when-after-fails.bal -WARNING [skip-when-after-fails.bal:(30:5,30:18)] unused variable 'i' +WARNING [skip-when-after-fails.bal:(30:5,30:18)] unused variable 'i' (BCE20403) + | +30 | int i = 12/0; + | ^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeEachFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeEachFails.txt index 9d03588b1210..9b4cf01de3f1 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeEachFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeEachFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source skip-when-beforeEach-fails.bal -WARNING [skip-when-beforeEach-fails.bal:(25:5,25:18)] unused variable 'i' +WARNING [skip-when-beforeEach-fails.bal:(25:5,25:18)] unused variable 'i' (BCE20403) + | +25 | int i = 12/0; + | ^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeFails.txt index 1853e4767f2e..4f0524525b62 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source skip-when-before-fails.bal -WARNING [skip-when-before-fails.bal:(28:5,28:18)] unused variable 'i' +WARNING [skip-when-before-fails.bal:(28:5,28:18)] unused variable 'i' (BCE20403) + | +28 | int i = 12/0; + | ^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeGroupsFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeGroupsFails.txt index f37fe856dcef..80e90e1fba94 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeGroupsFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeGroupsFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source skip-when-beforeGroups-fails.bal -WARNING [skip-when-beforeGroups-fails.bal:(32:5,32:17)] unused variable 'b' +WARNING [skip-when-beforeGroups-fails.bal:(32:5,32:17)] unused variable 'b' (BCE20403) + | +32 | int b = 2/0; + | ^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeSuiteFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeSuiteFails.txt index b0b198468ef8..8000f39ef738 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeSuiteFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenBeforeSuiteFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source skip-when-beforeSuite-fails.bal -WARNING [skip-when-beforeSuite-fails.bal:(24:5,24:18)] unused variable 'i' +WARNING [skip-when-beforeSuite-fails.bal:(24:5,24:18)] unused variable 'i' (BCE20403) + | +24 | int i = 12/0; // This will throw an exception and fail the function + | ^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenDependsOnFunctionFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenDependsOnFunctionFails.txt index 4686fd83e79f..7f50ab977259 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenDependsOnFunctionFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/SkipTestsTestCase-testSkipWhenDependsOnFunctionFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source dependson-skip-test.bal -WARNING [dependson-skip-test.bal:(34:5,34:18)] unused variable 'i' +WARNING [dependson-skip-test.bal:(34:5,34:18)] unused variable 'i' (BCE20403) + | +34 | int i = 12/0; + | ^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/TestReportTest-testWarningForCoverageFormatFlag.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/TestReportTest-testWarningForCoverageFormatFlag.txt index 99cc6a5014a2..67836b2483da 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/TestReportTest-testWarningForCoverageFormatFlag.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/TestReportTest-testWarningForCoverageFormatFlag.txt @@ -1,7 +1,11 @@ warning: ignoring --coverage-format flag since code coverage is not enabled Compiling source testerina_report/foo:0.0.0 -WARNING [main.bal:(36:5,36:19)] unused variable 'b' +WARNING [main.bal:(36:5,36:19)] unused variable 'b' (BCE20403) + | +36 | int b = a + 1; + | ^^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/TestReportTest-testWarningForReportTools.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/TestReportTest-testWarningForReportTools.txt index 40b924d70612..4517bd3011cd 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/unix/TestReportTest-testWarningForReportTools.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/unix/TestReportTest-testWarningForReportTools.txt @@ -1,6 +1,10 @@ Compiling source testerina_report/foo:0.0.0 -WARNING [main.bal:(36:5,36:19)] unused variable 'b' +WARNING [main.bal:(36:5,36:19)] unused variable 'b' (BCE20403) + | +36 | int b = a + 1; + | ^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAnnotationAccess.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAnnotationAccess.txt index 8d4059d02d49..0fcfb1c25cf6 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAnnotationAccess.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAnnotationAccess.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertBehavioralTypes.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertBehavioralTypes.txt index 59dd1b2eb189..f8ff1c48fa1e 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertBehavioralTypes.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertBehavioralTypes.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertDiffError.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertDiffError.txt index d29c46fb8b2f..ac32eb886c7a 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertDiffError.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertDiffError.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertStructuralTypes.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertStructuralTypes.txt index 9b6a9337584d..d2e3f32b6bf7 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertStructuralTypes.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertStructuralTypes.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertionErrorMessage.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertionErrorMessage.txt index 3fc5195f45c8..b24ce0643bbd 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertionErrorMessage.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/BasicCasesTest-testAssertionErrorMessage.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testArrayDataProviderWithFail.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testArrayDataProviderWithFail.txt index dc4868b06f38..23ddf9693114 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testArrayDataProviderWithFail.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testArrayDataProviderWithFail.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testArrayDataRerunFailedTest.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testArrayDataRerunFailedTest.txt index 20df320a02c2..b3e97cf070e0 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testArrayDataRerunFailedTest.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testArrayDataRerunFailedTest.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys0.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys0.txt index 36e950726ca0..428e94b2a7ea 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys0.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys0.txt @@ -1,27 +1,35 @@ -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' - -Running Tests with Coverage - - dataproviders - [pass] testFunction3#`'"\a"" - - - 1 passing - 0 failing - 0 skipped - - Test execution time :*****s - - dataproviders.module1 - - - No tests found - - Test execution time :*****s - -Generating Test Report - data-providers\target\report\test_results.json - +Compiling source + intg_tests/dataproviders:0.0.0 +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 + + dataproviders + [pass] testFunction3#`'"\a"" + + + 1 passing + 0 failing + 0 skipped + + Test execution time :*****s + + dataproviders.module1 + + + No tests found + + Test execution time :*****s + +Generating Test Report + data-providers\target\report\test_results.json + diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys1.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys1.txt index 39b96e58df95..adfdb2c74734 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys1.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys1.txt @@ -1,27 +1,35 @@ -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' - -Running Tests with Coverage - - dataproviders - [pass] testFunction3#"\u{D7FF}"" " - - - 1 passing - 0 failing - 0 skipped - - Test execution time :*****s - - dataproviders.module1 - - - No tests found - - Test execution time :*****s - -Generating Test Report - data-providers\target\report\test_results.json - +Compiling source + intg_tests/dataproviders:0.0.0 +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 + + dataproviders + [pass] testFunction3#"\u{D7FF}"" " + + + 1 passing + 0 failing + 0 skipped + + Test execution time :*****s + + dataproviders.module1 + + + No tests found + + Test execution time :*****s + +Generating Test Report + data-providers\target\report\test_results.json + diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys2.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys2.txt index 846fbfc0eab9..96a3c3e74344 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys2.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys2.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys3.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys3.txt index 8df54d7c847a..4038469bf3af 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys3.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys3.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys4.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys4.txt index a9da367d8d27..b2c4558842b9 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys4.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys4.txt @@ -1,27 +1,35 @@ -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' - -Running Tests with Coverage - - dataproviders - [pass] testFunction3#(1 - - - 1 passing - 0 failing - 0 skipped - - Test execution time :*****s - - dataproviders.module1 - - - No tests found - - Test execution time :*****s - -Generating Test Report - data-providers\target\report\test_results.json - +Compiling source + intg_tests/dataproviders:0.0.0 +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 + + dataproviders + [pass] testFunction3#(1 + + + 1 passing + 0 failing + 0 skipped + + Test execution time :*****s + + dataproviders.module1 + + + No tests found + + Test execution time :*****s + +Generating Test Report + data-providers\target\report\test_results.json + diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys5.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys5.txt index ce01863d1b3e..2ef6192270ee 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys5.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys5.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys6.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys6.txt index 59daf1e51894..45f8aedac945 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys6.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeys6.txt @@ -1,27 +1,35 @@ -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' - -Running Tests with Coverage - - dataproviders - [pass] testFunction3#map v = { "x": 1 }; - - - 1 passing - 0 failing - 0 skipped - - Test execution time :*****s - - dataproviders.module1 - - - No tests found - - Test execution time :*****s - -Generating Test Report - data-providers\target\report\test_results.json - +Compiling source + intg_tests/dataproviders:0.0.0 +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 + + dataproviders + [pass] testFunction3#map v = { "x": 1 }; + + + 1 passing + 0 failing + 0 skipped + + Test execution time :*****s + + dataproviders.module1 + + + No tests found + + Test execution time :*****s + +Generating Test Report + data-providers\target\report\test_results.json + diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard0.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard0.txt index 36e950726ca0..7e4bc6cadcae 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard0.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard0.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard1.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard1.txt index 39b96e58df95..c5e790b08558 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard1.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard1.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard2.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard2.txt index 846fbfc0eab9..96a3c3e74344 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard2.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard2.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard3.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard3.txt index 8df54d7c847a..4038469bf3af 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard3.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard3.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard4.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard4.txt index a9da367d8d27..ffb95dc8a9af 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard4.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard4.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard5.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard5.txt index ce01863d1b3e..2ef6192270ee 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard5.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard5.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard6.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard6.txt index 59daf1e51894..661f925e4884 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard6.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testCodeFragmentKeysWithWildCard6.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testDataProviderSingleFailure.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testDataProviderSingleFailure.txt index 9af0622d91df..eb7bf4b9c621 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testDataProviderSingleFailure.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testDataProviderSingleFailure.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testDataProviderWithMixedType.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testDataProviderWithMixedType.txt index 63796d312b20..6fce7c4b7819 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testDataProviderWithMixedType.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testDataProviderWithMixedType.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testMapValueDataProvider.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testMapValueDataProvider.txt index db70ccdddf8d..f2b1d8457ed9 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testMapValueDataProvider.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testMapValueDataProvider.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testMultiModuleSingleTestExec.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testMultiModuleSingleTestExec.txt index 81d65f58a0a3..56a4b87f020f 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testMultiModuleSingleTestExec.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testMultiModuleSingleTestExec.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testRerunFailedTest.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testRerunFailedTest.txt index 56ec02fefcd6..b53f23311bc1 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testRerunFailedTest.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testRerunFailedTest.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProvider.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProvider.txt index 6be496f855a4..9fbbffcd73cb 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProvider.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProvider.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderCase.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderCase.txt index 24d228d4e228..3624de81b1af 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderCase.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderCase.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithAfterFailing.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithAfterFailing.txt index ec7dfbb075fd..bd6c2cdae5dc 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithAfterFailing.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithAfterFailing.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithBeforeAfterFunctions.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithBeforeAfterFunctions.txt index 7b00744184aa..f3049edb4888 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithBeforeAfterFunctions.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithBeforeAfterFunctions.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithBeforeFailing.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithBeforeFailing.txt index 577e8d2d8eda..d8f009e00abf 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithBeforeFailing.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithBeforeFailing.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithFail.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithFail.txt index 05de187b5b78..5b3a29d59fb5 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithFail.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testValidDataProviderWithFail.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testWithSpecialKeys.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testWithSpecialKeys.txt index 4b115af65bcd..5db2ce2dfbb3 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testWithSpecialKeys.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/DataProviderTest-testWithSpecialKeys.txt @@ -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 diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/GroupingTest-testWhenAfterGroupsFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/GroupingTest-testWhenAfterGroupsFails.txt index 810d17422460..da28452c8b95 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/GroupingTest-testWhenAfterGroupsFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/GroupingTest-testWhenAfterGroupsFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source failed-after-groups-test.bal -WARNING [failed-after-groups-test.bal:(37:5,37:17)] unused variable 'b' +WARNING [failed-after-groups-test.bal:(37:5,37:17)] unused variable 'b' (BCE20403) + | +37 | int b = 2/0; + | ^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testEmptyDataProvider.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testEmptyDataProvider.txt index 56612731e9f7..c0b77ef50351 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testEmptyDataProvider.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testEmptyDataProvider.txt @@ -2,5 +2,9 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source empty-data-provider-test.bal -ERROR [empty-data-provider-test.bal:(14:19,14:28)] incompatible types: expected 'function () returns (ballerina/test:0.0.0:DataProviderReturnType)?', found 'function () returns (int[])' -error: compilation contains errors \ No newline at end of file +ERROR [empty-data-provider-test.bal:(14:19,14:28)] incompatible types: expected 'function () returns (ballerina/test:0.0.0:DataProviderReturnType)?', found 'function () returns (int[])' (BCE2066) + | +14 | dataProvider: provider2 + | ^^^^^^^^^ + +error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider.txt index 8298a3d541b0..3f755057565e 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source invalid-data-provider-test.bal -WARNING [invalid-data-provider-test.bal:(25:5,25:58)] unused variable 'resultErr' +WARNING [invalid-data-provider-test.bal:(25:5,25:58)] unused variable 'resultErr' (BCE20403) + | +25 | int|error resultErr = trap result.cloneWithType(int); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider2.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider2.txt index ddae8eaf4b04..20ef8a3913d6 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider2.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidDataProviderTestCase-testInvalidDataProvider2.txt @@ -2,9 +2,21 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source invalid-data-provider-test2.bal -WARNING [invalid-data-provider-test2.bal:(25:5,25:53)] unused variable 'fErr' -WARNING [invalid-data-provider-test2.bal:(26:5,26:53)] unused variable 'sErr' -WARNING [invalid-data-provider-test2.bal:(27:5,27:58)] unused variable 'resultErr' +WARNING [invalid-data-provider-test2.bal:(25:5,25:53)] unused variable 'fErr' (BCE20403) + | +25 | int|error fErr = trap fValue.cloneWithType(int); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [invalid-data-provider-test2.bal:(26:5,26:53)] unused variable 'sErr' (BCE20403) + | +26 | int|error sErr = trap sValue.cloneWithType(int); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [invalid-data-provider-test2.bal:(27:5,27:58)] unused variable 'resultErr' (BCE20403) + | +27 | int|error resultErr = trap result.cloneWithType(int); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInNonExistingModule.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInNonExistingModule.txt index c037b79b9f0d..e5e81e50f2f5 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInNonExistingModule.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInNonExistingModule.txt @@ -1,4 +1,12 @@ Compiling source intg_tests/non_existent_module_mock:0.1.0 ERROR [tests\test.bal:(3:1,6:2)] could not find specified module 'intg_tests/module1:0.1.0' + | +3 | @test:Mock { +: | ^^^^^^^^^^^^ +: | : +: | : +6 | } + | ^ + error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInSingleFileProject.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInSingleFileProject.txt index e9b3b3bd2ccc..fbbae2d0ee8c 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInSingleFileProject.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingFunctionInSingleFileProject.txt @@ -3,4 +3,8 @@ warning: ignoring --includes flag since code coverage is not enabled Compiling source function-legacy-mock.bal ERROR [function-legacy-mock.bal:(8:1,8:38)] function mocking is not supported with standalone Ballerina files + | +8 | @test:Mock { functionName: "intAdd" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingFunctionWithIncompatibleTypes.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingFunctionWithIncompatibleTypes.txt index 537c1fa15bfe..5696bd3b734c 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingFunctionWithIncompatibleTypes.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingFunctionWithIncompatibleTypes.txt @@ -1,4 +1,12 @@ Compiling source intg_tests/incompatible_type_mock:0.1.0 ERROR [tests\test.bal:(6:1,8:2)] incompatible types: expected isolated function () returns (string) but found isolated function () returns (int) + | +6 | function getMockClient() returns int { +: | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +: | : +: | : +8 | } + | ^ + error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingNonExistingFunction.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingNonExistingFunction.txt index 1b90b3e50c80..6bdf21c0ef13 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingNonExistingFunction.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingNonExistingFunction.txt @@ -1,4 +1,12 @@ Compiling source intg_tests/non_existent_function_mock:0.1.0 ERROR [tests\test.bal:(3:1,5:2)] could not find function 'createJdbcClient' in module 'intg_tests/non_existent_function_mock:0.1.0' + | +3 | @test:Mock { +: | ^^^^^^^^^^^^ +: | : +: | : +5 | } + | ^ + error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingWithEmptyAnnotationRecord.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingWithEmptyAnnotationRecord.txt index 498299af288d..15dee64e1dc7 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingWithEmptyAnnotationRecord.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingWithEmptyAnnotationRecord.txt @@ -1,4 +1,8 @@ Compiling source intg_tests/empty_annot_rec_function_mock:0.1.0 ERROR [tests\test.bal:(3:1,3:14)] function name cannot be empty + | +3 | @test:Mock {} + | ^^^^^^^^^^^^^ + error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingWithoutAnnotationRecord.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingWithoutAnnotationRecord.txt index 17ad4fff2996..2609ed9c4440 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingWithoutAnnotationRecord.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testLegacyMockingWithoutAnnotationRecord.txt @@ -1,4 +1,8 @@ Compiling source intg_tests/recordless_annot_function_mock:0.1.0 ERROR [tests\test.bal:(3:1,3:11)] missing required 'functionName' field + | +3 | @test:Mock + | ^^^^^^^^^^ + error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingFunctionInNonExistingModule.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingFunctionInNonExistingModule.txt index c037b79b9f0d..e5e81e50f2f5 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingFunctionInNonExistingModule.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingFunctionInNonExistingModule.txt @@ -1,4 +1,12 @@ Compiling source intg_tests/non_existent_module_mock:0.1.0 ERROR [tests\test.bal:(3:1,6:2)] could not find specified module 'intg_tests/module1:0.1.0' + | +3 | @test:Mock { +: | ^^^^^^^^^^^^ +: | : +: | : +6 | } + | ^ + error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingFunctionInSingleFileProject.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingFunctionInSingleFileProject.txt index 5f65b32f2d6f..54a818f73c5a 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingFunctionInSingleFileProject.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingFunctionInSingleFileProject.txt @@ -3,4 +3,8 @@ warning: ignoring --includes flag since code coverage is not enabled Compiling source function-mock.bal ERROR [function-mock.bal:(12:1,12:38)] function mocking is not supported with standalone Ballerina files + | +12 | @test:Mock { functionName: "intAdd" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingNonExistingFunction.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingNonExistingFunction.txt index 3bb26045a8a0..60d6a53d74b4 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingNonExistingFunction.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingNonExistingFunction.txt @@ -1,4 +1,8 @@ Compiling source intg_tests/non_existent_function_mock:0.1.0 ERROR [tests\test.bal:(3:1,3:38)] could not find function 'intAdd' in module 'intg_tests/non_existent_function_mock:0.1.0' + | +3 | @test:Mock { functionName: "intAdd" } + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingWithEmptyAnnotationRecord.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingWithEmptyAnnotationRecord.txt index 498299af288d..15dee64e1dc7 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingWithEmptyAnnotationRecord.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingWithEmptyAnnotationRecord.txt @@ -1,4 +1,8 @@ Compiling source intg_tests/empty_annot_rec_function_mock:0.1.0 ERROR [tests\test.bal:(3:1,3:14)] function name cannot be empty + | +3 | @test:Mock {} + | ^^^^^^^^^^^^^ + error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingWithoutAnnotationRecord.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingWithoutAnnotationRecord.txt index 17ad4fff2996..2609ed9c4440 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingWithoutAnnotationRecord.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/InvalidFunctionMockingTestCase-testMockingWithoutAnnotationRecord.txt @@ -1,4 +1,8 @@ Compiling source intg_tests/recordless_annot_function_mock:0.1.0 ERROR [tests\test.bal:(3:1,3:11)] missing required 'functionName' field + | +3 | @test:Mock + | ^^^^^^^^^^ + error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MissingFunctionsTestCase-testMissingAfterFunction.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MissingFunctionsTestCase-testMissingAfterFunction.txt index 0d82ae4f677f..45f400b55340 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MissingFunctionsTestCase-testMissingAfterFunction.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MissingFunctionsTestCase-testMissingAfterFunction.txt @@ -2,5 +2,9 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source after-func-negative.bal -ERROR [after-func-negative.bal:(22:12,22:29)] undefined symbol 'afterFuncNonExist' -error: compilation contains errors \ No newline at end of file +ERROR [after-func-negative.bal:(22:12,22:29)] undefined symbol 'afterFuncNonExist' (BCE2010) + | +22 | after: afterFuncNonExist + | ^^^^^^^^^^^^^^^^^ + +error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MissingFunctionsTestCase-testMissingBeforeFunction.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MissingFunctionsTestCase-testMissingBeforeFunction.txt index d357e7acaa57..5466561952cb 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MissingFunctionsTestCase-testMissingBeforeFunction.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MissingFunctionsTestCase-testMissingBeforeFunction.txt @@ -2,5 +2,9 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source before-func-negative.bal -ERROR [before-func-negative.bal:(22:13,22:31)] undefined symbol 'beforeFuncNonExist' -error: compilation contains errors \ No newline at end of file +ERROR [before-func-negative.bal:(22:13,22:31)] undefined symbol 'beforeFuncNonExist' (BCE2010) + | +22 | before: beforeFuncNonExist + | ^^^^^^^^^^^^^^^^^^ + +error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MissingFunctionsTestCase-testMissingDependsOnFunction.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MissingFunctionsTestCase-testMissingDependsOnFunction.txt index af5514ab7a62..e5f0e38616ac 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MissingFunctionsTestCase-testMissingDependsOnFunction.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MissingFunctionsTestCase-testMissingDependsOnFunction.txt @@ -2,5 +2,9 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source depends-on-negative.bal -ERROR [depends-on-negative.bal:(22:17,22:28)] undefined symbol 'nonExisting' -error: compilation contains errors \ No newline at end of file +ERROR [depends-on-negative.bal:(22:17,22:28)] undefined symbol 'nonExisting' (BCE2010) + | +22 | dependsOn: [nonExisting] + | ^^^^^^^^^^^ + +error: compilation contains errors diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking.txt index 2ef5c8d90973..c0062400c0f5 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking.txt @@ -1,113 +1,121 @@ -Compiling source - intg_tests/object_mocking:0.0.0 -WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' - -Running Tests with Coverage - - object_mocking - - testDefaultIncompatibleArgs has failed. - - - testDefaultInvalidMemberReturnValue has failed. - - - testDefaultMockInvalidFieldName has failed. - - - testDefaultMockInvalidReturnValue has failed. - - - testDefaultMockWrongAction has failed. - - - testDefaultTooManyArgs has failed. - - - testMockInvalidStream has failed. - - [pass] testDependentlyTypedFunctions_testDouble - [pass] testDependentlyTypedFunctions_thenReturn - [pass] testMockMemberVariable - [pass] testMockStreamSuccess - [pass] testProvideAReturnSequence - [pass] testProvideAReturnValue - [pass] testProvideAReturnValueBasedOnInput - [pass] testProvideErrorReturnValue - [pass] testUserDefinedMockObject - - [fail] testDefaultIncompatibleArgs: - - error {ballerina/test:0}FunctionSignatureMismatchError ("incorrect type of argument provided at position '1' to mock the function 'get()'") - callableName: validateArgumentsExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 535 - callableName: withArguments moduleName: ballerina.test.0.MemberFunctionStub fileName: mock.bal lineNumber: 160 - callableName: testDefaultIncompatibleArgs moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 56 - callableName: testDefaultIncompatibleArgs$lambda3$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 7 - - - [fail] testDefaultInvalidMemberReturnValue: - - error {ballerina/test:0}InvalidMemberFieldError ("return value provided does not match the type of 'url'") - callableName: thenReturnExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 562 - callableName: thenReturn moduleName: ballerina.test.0.MemberVariableStub fileName: mock.bal lineNumber: 373 - callableName: testDefaultInvalidMemberReturnValue moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 74 - callableName: testDefaultInvalidMemberReturnValue$lambda5$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 9 - - - [fail] testDefaultMockInvalidFieldName: - - error {ballerina/test:0}InvalidMemberFieldError ("invalid field name 'invalidField' provided") - callableName: validateFieldNameExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 526 - callableName: getMember moduleName: ballerina.test.0.MockObject fileName: mock.bal lineNumber: 123 - callableName: testDefaultMockInvalidFieldName moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 65 - callableName: testDefaultMockInvalidFieldName$lambda4$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 8 - - - [fail] testDefaultMockInvalidReturnValue: - - error {ballerina/test:0}FunctionSignatureMismatchError ("return value provided does not match the return type of function 'get()'") - callableName: thenReturnExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 562 - callableName: thenReturn moduleName: ballerina.test.0.MemberFunctionStub fileName: mock.bal lineNumber: 176 - callableName: testDefaultMockInvalidReturnValue moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 35 - callableName: testDefaultMockInvalidReturnValue$lambda0$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 4 - - - [fail] testDefaultMockWrongAction: - - error {ballerina/test:0}FunctionSignatureMismatchError ("return value provided does not match the return type of function 'get()'") - callableName: thenReturnExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 562 - callableName: doNothing moduleName: ballerina.test.0.MemberFunctionStub fileName: mock.bal lineNumber: 208 - callableName: testDefaultMockWrongAction moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 42 - callableName: testDefaultMockWrongAction$lambda1$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 5 - - - [fail] testDefaultTooManyArgs: - - error {ballerina/test:0}FunctionSignatureMismatchError ("too many argument provided to mock the function 'get()'") - callableName: validateArgumentsExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 535 - callableName: withArguments moduleName: ballerina.test.0.MemberFunctionStub fileName: mock.bal lineNumber: 160 - callableName: testDefaultTooManyArgs moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 49 - callableName: testDefaultTooManyArgs$lambda2$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 6 - - - [fail] testMockInvalidStream: - - error {ballerina/test:0}FunctionSignatureMismatchError ("return value provided does not match the return type of function 'get_stream()'") - callableName: thenReturnExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 562 - callableName: thenReturn moduleName: ballerina.test.0.MemberFunctionStub fileName: mock.bal lineNumber: 176 - callableName: testMockInvalidStream moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 81 - callableName: testMockInvalidStream$lambda6$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 10 - - - - 9 passing - 7 failing - 0 skipped - - Test execution time :*****s - -Generating Test Report - object-mocking-tests\target\report\test_results.json - -error: there are test failures +Compiling source + intg_tests/object_mocking:0.0.0 +WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + + +Running Tests with Coverage + + object_mocking + + testDefaultIncompatibleArgs has failed. + + + testDefaultInvalidMemberReturnValue has failed. + + + testDefaultMockInvalidFieldName has failed. + + + testDefaultMockInvalidReturnValue has failed. + + + testDefaultMockWrongAction has failed. + + + testDefaultTooManyArgs has failed. + + + testMockInvalidStream has failed. + + [pass] testDependentlyTypedFunctions_testDouble + [pass] testDependentlyTypedFunctions_thenReturn + [pass] testMockMemberVariable + [pass] testMockStreamSuccess + [pass] testProvideAReturnSequence + [pass] testProvideAReturnValue + [pass] testProvideAReturnValueBasedOnInput + [pass] testProvideErrorReturnValue + [pass] testUserDefinedMockObject + + [fail] testDefaultIncompatibleArgs: + + error {ballerina/test:0}FunctionSignatureMismatchError ("incorrect type of argument provided at position '1' to mock the function 'get()'") + callableName: validateArgumentsExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 535 + callableName: withArguments moduleName: ballerina.test.0.MemberFunctionStub fileName: mock.bal lineNumber: 160 + callableName: testDefaultIncompatibleArgs moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 56 + callableName: testDefaultIncompatibleArgs$lambda3$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 7 + + + [fail] testDefaultInvalidMemberReturnValue: + + error {ballerina/test:0}InvalidMemberFieldError ("return value provided does not match the type of 'url'") + callableName: thenReturnExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 562 + callableName: thenReturn moduleName: ballerina.test.0.MemberVariableStub fileName: mock.bal lineNumber: 373 + callableName: testDefaultInvalidMemberReturnValue moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 74 + callableName: testDefaultInvalidMemberReturnValue$lambda5$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 9 + + + [fail] testDefaultMockInvalidFieldName: + + error {ballerina/test:0}InvalidMemberFieldError ("invalid field name 'invalidField' provided") + callableName: validateFieldNameExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 526 + callableName: getMember moduleName: ballerina.test.0.MockObject fileName: mock.bal lineNumber: 123 + callableName: testDefaultMockInvalidFieldName moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 65 + callableName: testDefaultMockInvalidFieldName$lambda4$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 8 + + + [fail] testDefaultMockInvalidReturnValue: + + error {ballerina/test:0}FunctionSignatureMismatchError ("return value provided does not match the return type of function 'get()'") + callableName: thenReturnExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 562 + callableName: thenReturn moduleName: ballerina.test.0.MemberFunctionStub fileName: mock.bal lineNumber: 176 + callableName: testDefaultMockInvalidReturnValue moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 35 + callableName: testDefaultMockInvalidReturnValue$lambda0$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 4 + + + [fail] testDefaultMockWrongAction: + + error {ballerina/test:0}FunctionSignatureMismatchError ("return value provided does not match the return type of function 'get()'") + callableName: thenReturnExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 562 + callableName: doNothing moduleName: ballerina.test.0.MemberFunctionStub fileName: mock.bal lineNumber: 208 + callableName: testDefaultMockWrongAction moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 42 + callableName: testDefaultMockWrongAction$lambda1$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 5 + + + [fail] testDefaultTooManyArgs: + + error {ballerina/test:0}FunctionSignatureMismatchError ("too many argument provided to mock the function 'get()'") + callableName: validateArgumentsExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 535 + callableName: withArguments moduleName: ballerina.test.0.MemberFunctionStub fileName: mock.bal lineNumber: 160 + callableName: testDefaultTooManyArgs moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 49 + callableName: testDefaultTooManyArgs$lambda2$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 6 + + + [fail] testMockInvalidStream: + + error {ballerina/test:0}FunctionSignatureMismatchError ("return value provided does not match the return type of function 'get_stream()'") + callableName: thenReturnExt moduleName: ballerina.test.0 fileName: mock.bal lineNumber: 562 + callableName: thenReturn moduleName: ballerina.test.0.MemberFunctionStub fileName: mock.bal lineNumber: 176 + callableName: testMockInvalidStream moduleName: intg_tests.object_mocking$test.0.tests.main_error_test fileName: tests/main_error_test.bal lineNumber: 81 + callableName: testMockInvalidStream$lambda6$ moduleName: intg_tests.object_mocking$test.0.tests.test_execute-generated_*****lineNumber: 10 + + + + 9 passing + 7 failing + 0 skipped + + Test execution time :*****s + +Generating Test Report + object-mocking-tests\target\report\test_results.json + +error: there are test failures diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases1.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases1.txt index 2f361383543c..c6a0c77262ea 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases1.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases1.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases2.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases2.txt index 8c27559b230d..59b344b1cbee 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases2.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases2.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases3.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases3.txt index 3b88e7e05b1a..49652b41ca3b 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases3.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases3.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases4.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases4.txt index ae9387d341ee..035e917cda53 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases4.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases4.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases5.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases5.txt index ca5934c3ad51..e33d6358c7ed 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases5.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases5.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases6.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases6.txt index 1b34b1af98c1..3b3cb2d1995f 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases6.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases6.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases7.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases7.txt index 50fa436dc175..b5f10e968a9a 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases7.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/MockTest-testObjectMocking_NegativeCases7.txt @@ -1,7 +1,15 @@ Compiling source intg_tests/object_mocking:0.0.0 -WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value -WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' +WARNING [modules\TestHttpClient\main.bal:(64:45,64:82)] this function should explicitly return a value (BCE20350) + | +64 | public isolated function next() returns record {|AttributeDAO value;|}|Error? { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +WARNING [main.bal:(53:5,53:47)] unused variable 'closeErr' (BCE20403) + | +53 | error? closeErr = attributeStream.close(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + Running Tests with Coverage diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenAfterEachFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenAfterEachFails.txt index 0c8de27d3b27..9bacccc66c54 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenAfterEachFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenAfterEachFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source skip-when-afterEach-fails.bal -WARNING [skip-when-afterEach-fails.bal:(30:5,30:18)] unused variable 'i' +WARNING [skip-when-afterEach-fails.bal:(30:5,30:18)] unused variable 'i' (BCE20403) + | +30 | int i = 12/0; + | ^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenAfterFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenAfterFails.txt index 0e6d69a2410f..d2c833dd2a35 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenAfterFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenAfterFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source skip-when-after-fails.bal -WARNING [skip-when-after-fails.bal:(30:5,30:18)] unused variable 'i' +WARNING [skip-when-after-fails.bal:(30:5,30:18)] unused variable 'i' (BCE20403) + | +30 | int i = 12/0; + | ^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeEachFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeEachFails.txt index 83a329911803..6bb364aeca42 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeEachFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeEachFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source skip-when-beforeEach-fails.bal -WARNING [skip-when-beforeEach-fails.bal:(25:5,25:18)] unused variable 'i' +WARNING [skip-when-beforeEach-fails.bal:(25:5,25:18)] unused variable 'i' (BCE20403) + | +25 | int i = 12/0; + | ^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeFails.txt index 910433425ba8..8eaf184ff4a7 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source skip-when-before-fails.bal -WARNING [skip-when-before-fails.bal:(28:5,28:18)] unused variable 'i' +WARNING [skip-when-before-fails.bal:(28:5,28:18)] unused variable 'i' (BCE20403) + | +28 | int i = 12/0; + | ^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeGroupsFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeGroupsFails.txt index a107eab26887..74e2eb715348 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeGroupsFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeGroupsFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source skip-when-beforeGroups-fails.bal -WARNING [skip-when-beforeGroups-fails.bal:(32:5,32:17)] unused variable 'b' +WARNING [skip-when-beforeGroups-fails.bal:(32:5,32:17)] unused variable 'b' (BCE20403) + | +32 | int b = 2/0; + | ^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeSuiteFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeSuiteFails.txt index c29b4a9c4f02..b962eef8987b 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeSuiteFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenBeforeSuiteFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source skip-when-beforeSuite-fails.bal -WARNING [skip-when-beforeSuite-fails.bal:(24:5,24:18)] unused variable 'i' +WARNING [skip-when-beforeSuite-fails.bal:(24:5,24:18)] unused variable 'i' (BCE20403) + | +24 | int i = 12/0; // This will throw an exception and fail the function + | ^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenDependsOnFunctionFails.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenDependsOnFunctionFails.txt index 68b479077884..e5f2c73ae059 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenDependsOnFunctionFails.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/SkipTestsTestCase-testSkipWhenDependsOnFunctionFails.txt @@ -2,7 +2,11 @@ Code coverage is not yet supported with single bal files. Ignoring the flag and warning: ignoring --includes flag since code coverage is not enabled Compiling source dependson-skip-test.bal -WARNING [dependson-skip-test.bal:(34:5,34:18)] unused variable 'i' +WARNING [dependson-skip-test.bal:(34:5,34:18)] unused variable 'i' (BCE20403) + | +34 | int i = 12/0; + | ^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/TestReportTest-testWarningForCoverageFormatFlag.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/TestReportTest-testWarningForCoverageFormatFlag.txt index fc1daee66f65..503e56ad5a92 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/TestReportTest-testWarningForCoverageFormatFlag.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/TestReportTest-testWarningForCoverageFormatFlag.txt @@ -1,7 +1,11 @@ warning: ignoring --coverage-format flag since code coverage is not enabled Compiling source testerina_report/foo:0.0.0 -WARNING [main.bal:(36:5,36:19)] unused variable 'b' +WARNING [main.bal:(36:5,36:19)] unused variable 'b' (BCE20403) + | +36 | int b = a + 1; + | ^^^^^^^^^^^^^^ + Running Tests diff --git a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/TestReportTest-testWarningForReportTools.txt b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/TestReportTest-testWarningForReportTools.txt index 2a632515749e..2620b592690c 100644 --- a/tests/testerina-integration-test/src/test/resources/command-outputs/windows/TestReportTest-testWarningForReportTools.txt +++ b/tests/testerina-integration-test/src/test/resources/command-outputs/windows/TestReportTest-testWarningForReportTools.txt @@ -1,6 +1,10 @@ Compiling source testerina_report/foo:0.0.0 -WARNING [main.bal:(36:5,36:19)] unused variable 'b' +WARNING [main.bal:(36:5,36:19)] unused variable 'b' (BCE20403) + | +36 | int b = a + 1; + | ^^^^^^^^^^^^^^ + Running Tests with Coverage