mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-04-12 10:48:39 +03:00
test
This commit is contained in:
@ -34,7 +34,7 @@ pub const WindowPaddingColor = Config.WindowPaddingColor;
|
||||
|
||||
// Alternate APIs
|
||||
pub const CAPI = @import("config/CAPI.zig");
|
||||
pub const Wasm = if (!builtin.target.isWasm()) struct {} else @import("config/Wasm.zig");
|
||||
pub const Wasm = if (!builtin.target.cpu.arch.isWasm()) struct {} else @import("config/Wasm.zig");
|
||||
|
||||
test {
|
||||
@import("std").testing.refAllDecls(@This());
|
||||
|
@ -34,6 +34,8 @@ pub const Key = key: {
|
||||
/// Returns the value type for a key
|
||||
pub fn Value(comptime key: Key) type {
|
||||
const field = comptime field: {
|
||||
@setEvalBranchQuota(100_000);
|
||||
|
||||
const fields = std.meta.fields(Config);
|
||||
for (fields) |field| {
|
||||
if (@field(Key, field.name) == key) {
|
||||
|
@ -34,7 +34,7 @@ pub fn HashMap(
|
||||
return struct {
|
||||
const Self = @This();
|
||||
const Map = std.HashMapUnmanaged(K, *Queue.Node, Context, max_load_percentage);
|
||||
const Queue = std.TailQueue(KV);
|
||||
const Queue = std.DoublyLinkedList(KV);
|
||||
|
||||
/// Map to maintain our entries.
|
||||
map: Map,
|
||||
|
@ -51,7 +51,7 @@ pub const FlagStack = struct {
|
||||
// could send a huge number of pop commands to waste cpu.
|
||||
if (n >= self.flags.len) {
|
||||
self.idx = 0;
|
||||
self.flags = .{.{}} ** len;
|
||||
self.flags = .{Flags{}} ** len;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -343,7 +343,7 @@ pub const Set = RefCountedSet(
|
||||
test "Set basic usage" {
|
||||
const testing = std.testing;
|
||||
const alloc = testing.allocator;
|
||||
const layout = Set.layout(16);
|
||||
const layout: Set.Layout = .init(16);
|
||||
const buf = try alloc.alignedAlloc(u8, Set.base_align, layout.total_size);
|
||||
defer alloc.free(buf);
|
||||
|
||||
@ -397,5 +397,5 @@ test "Set basic usage" {
|
||||
|
||||
test "Set capacities" {
|
||||
// We want to support at least this many styles without overflowing.
|
||||
_ = Set.layout(16384);
|
||||
_ = Set.Layout.init(16384);
|
||||
}
|
||||
|
@ -233,10 +233,10 @@ test "encode" {
|
||||
try src.encode(buf_stream.writer());
|
||||
|
||||
const expected =
|
||||
"ghostty|xterm-ghostty|Ghostty\n" ++
|
||||
"ghostty|xterm-ghostty|Ghostty,\n" ++
|
||||
"\tam,\n" ++
|
||||
"\tccc@,\n" ++
|
||||
"\tcolors#256,\n" ++
|
||||
"\tbel=^G,\n\n";
|
||||
"\tbel=^G,\n";
|
||||
try std.testing.expectEqualStrings(@as([]const u8, expected), buf_stream.getWritten());
|
||||
}
|
||||
|
Reference in New Issue
Block a user