aboutsummaryrefslogtreecommitdiff
path: root/examples/snippets/error-example.zig
diff options
context:
space:
mode:
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();
+}