aboutsummaryrefslogtreecommitdiff
path: root/tests/run.pl
diff options
context:
space:
mode:
author_ov4 <ov4@ov4.org>2026-10-21 14:03:31 +0000
committer_ov4 <ov4@ov4.org>2026-10-21 14:03:31 +0000
commitb4ffb2d9498560557821714e2d4651279dd6817c (patch)
tree995ad02bdb8cc461f48a53683c4fd7f2ddd8656b /tests/run.pl
parentf1f5fa394a67a789914ccf2b24d534a0e466ae1b (diff)
feat(diagnostics): print source diagnostics in gcc file:line: layout
Lexer, parser, driver and codegen diagnostics now read "<path>:<line>: error: <message>" instead of "error: <message> at line N in <path>". The path is always printed as given on the command line. Call sites pass the bare message to cps::sourceError/sourceWarning, which carry printf format checking; reportError routes through the same helper. The suite iii harness parses the new layout and matches the reason against the message only. iii/template-class-pack-field passed only because its reason regex matched the case path, so it is now case-insensitive. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/run.pl')
-rw-r--r--tests/run.pl13
1 files changed, 8 insertions, 5 deletions
diff --git a/tests/run.pl b/tests/run.pl
index 86eff4f..2835d5e 100644
--- a/tests/run.pl
+++ b/tests/run.pl
@@ -113,18 +113,21 @@ sub check_diagnostics {
if (length($result->{stdout})) {
push @errors, 'unexpected stdout: ' . show_bytes(substr($result->{stdout}, 0, 1000));
}
- # ASCII markers (error:, line N) are matched on raw bytes; the compiler
- # emits UTF-8 and ASCII patterns are unaffected by decoding.
+ # Diagnostics use the gcc layout "<path>:<line>: error: <message>" and are
+ # matched on raw bytes; the compiler emits UTF-8 and ASCII patterns are
+ # unaffected by decoding. The non-greedy path keeps Windows "D:/" intact.
my @lines = split_records(normalized($result->{stderr}));
for my $expectation (@{$expectations}) {
my $reason = $expectation->{reason};
my $line_no = $expectation->{line};
+ my $file = $expectation->{file};
my @matching = grep { /error:/ && /$reason/ } @lines;
my $found = 0;
for my $line (@matching) {
- my $file = $expectation->{file};
- if ($line =~ /\bline $line_no\b/ &&
- (!defined($file) || $line =~ /\bline $line_no in \Q$file\E(?:\s|$)/)) {
+ next unless $line =~ /^(.+?):(\d+): error: (.*)$/;
+ my ($path, $number, $message) = ($1, $2, $3);
+ if ($number == $line_no && $message =~ /$reason/ &&
+ (!defined($file) || $path eq $file)) {
$found = 1;
last;
}