aboutsummaryrefslogtreecommitdiff
path: root/examples/snippets/error-example.zig
diff options
context:
space:
mode:
authorDavid Czihak <git@dcz.at>2026-05-09 13:01:50 +0200
committerDavid Czihak <git@dcz.at>2026-05-09 13:01:50 +0200
commit4b6f66fd512c254b5a82220dc77411fe391dd258 (patch)
tree7d77d7966e9ad2e296986ea8cfeb607088028195 /examples/snippets/error-example.zig
parent64e9c56fc665972fdde5234c4fb2f2a882e237dc (diff)
Chore: Rework examples for thorough extension testing
Diffstat (limited to 'examples/snippets/error-example.zig')
-rw-r--r--examples/snippets/error-example.zig19
1 files changed, 19 insertions, 0 deletions
diff --git a/examples/snippets/error-example.zig b/examples/snippets/error-example.zig
new file mode 100644
index 0000000..f35c684
--- /dev/null
+++ b/examples/snippets/error-example.zig
@@ -0,0 +1,19 @@
+// INVALID FILE — used to test the Nova issue matcher.
+//
+// Open this file and run it with the "Current Zig File" task (zig run).
+// The compiler will report an error that the issue matcher captures:
+//
+// error-example.zig:16:23: error: type 'u8' cannot represent integer value '300'
+//
+// This verifies that the regexp ^(.+?):(\d+):(\d+):\s*(error|warning):\s*(.+)$
+// correctly extracts file, line, column, severity, and message.
+
+const std = @import("std");
+
+pub fn main() void {
+ // The literal 300 does not fit in a u8 (max 255). Zig catches
+ // this at compile time and reports an error at this line.
+ const value: u8 = 300;
+ _ = value;
+ _ = std.io.getStdOut();
+}