mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-13 19:15:48 +00:00
terminal: guard ghostty.h checks on building the app
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -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_");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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_");
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user