From 04b5dc733243d85f0bbaa3aea25d65a19649cd64 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 23 Mar 2026 08:58:56 -0700 Subject: [PATCH] terminal: guard ghostty.h checks on building the app --- src/lib/enum.zig | 5 ++++- src/lib_vt.zig | 10 +++++----- src/terminal/mouse.zig | 1 + src/terminal/osc.zig | 1 + 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/lib/enum.zig b/src/lib/enum.zig index bdec2ab88..f40a40b54 100644 --- a/src/lib/enum.zig +++ b/src/lib/enum.zig @@ -95,7 +95,10 @@ test "abi by removing a key" { /// Verify that for every key in enum T, there is a matching declaration in /// `ghostty.h` with the correct value. This should only ever be called inside a `test` /// because the `ghostty.h` module is only available then. -pub fn checkGhosttyHEnum(comptime T: type, comptime prefix: []const u8) !void { +pub fn checkGhosttyHEnum( + comptime T: type, + comptime prefix: []const u8, +) !void { const info = @typeInfo(T); try std.testing.expect(info == .@"enum"); diff --git a/src/lib_vt.zig b/src/lib_vt.zig index 7a75bb92a..01cea6bcd 100644 --- a/src/lib_vt.zig +++ b/src/lib_vt.zig @@ -260,9 +260,9 @@ pub const std_options: std.Options = options: { test { _ = terminal; - _ = @import("lib/main.zig"); - @import("std").testing.refAllDecls(input); - if (comptime terminal.options.c_abi) { - _ = terminal.c_api; - } + // _ = @import("lib/main.zig"); + // @import("std").testing.refAllDecls(input); + // if (comptime terminal.options.c_abi) { + // _ = terminal.c_api; + // } } diff --git a/src/terminal/mouse.zig b/src/terminal/mouse.zig index e72e166f7..5286ab856 100644 --- a/src/terminal/mouse.zig +++ b/src/terminal/mouse.zig @@ -92,6 +92,7 @@ pub const Shape = enum(c_int) { }; test "ghostty.h MouseShape" { + if (comptime build_options.artifact == .lib) return error.SkipZigTest; try lib.checkGhosttyHEnum(Shape, "GHOSTTY_MOUSE_SHAPE_"); } }; diff --git a/src/terminal/osc.zig b/src/terminal/osc.zig index 0086e48bc..920ce3f7e 100644 --- a/src/terminal/osc.zig +++ b/src/terminal/osc.zig @@ -205,6 +205,7 @@ pub const Command = union(Key) { pause, test "ghostty.h Command.ProgressReport.State" { + if (comptime build_options.artifact == .lib) return error.SkipZigTest; try lib.checkGhosttyHEnum(State, "GHOSTTY_PROGRESS_STATE_"); } };