test
parent
2408d4c6a9
commit
43467690f3
|
|
@ -34,7 +34,7 @@ pub const WindowPaddingColor = Config.WindowPaddingColor;
|
||||||
|
|
||||||
// Alternate APIs
|
// Alternate APIs
|
||||||
pub const CAPI = @import("config/CAPI.zig");
|
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 {
|
test {
|
||||||
@import("std").testing.refAllDecls(@This());
|
@import("std").testing.refAllDecls(@This());
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ pub const Key = key: {
|
||||||
/// Returns the value type for a key
|
/// Returns the value type for a key
|
||||||
pub fn Value(comptime key: Key) type {
|
pub fn Value(comptime key: Key) type {
|
||||||
const field = comptime field: {
|
const field = comptime field: {
|
||||||
|
@setEvalBranchQuota(100_000);
|
||||||
|
|
||||||
const fields = std.meta.fields(Config);
|
const fields = std.meta.fields(Config);
|
||||||
for (fields) |field| {
|
for (fields) |field| {
|
||||||
if (@field(Key, field.name) == key) {
|
if (@field(Key, field.name) == key) {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ pub fn HashMap(
|
||||||
return struct {
|
return struct {
|
||||||
const Self = @This();
|
const Self = @This();
|
||||||
const Map = std.HashMapUnmanaged(K, *Queue.Node, Context, max_load_percentage);
|
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 to maintain our entries.
|
||||||
map: Map,
|
map: Map,
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ pub const FlagStack = struct {
|
||||||
// could send a huge number of pop commands to waste cpu.
|
// could send a huge number of pop commands to waste cpu.
|
||||||
if (n >= self.flags.len) {
|
if (n >= self.flags.len) {
|
||||||
self.idx = 0;
|
self.idx = 0;
|
||||||
self.flags = .{.{}} ** len;
|
self.flags = .{Flags{}} ** len;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,7 @@ pub const Set = RefCountedSet(
|
||||||
test "Set basic usage" {
|
test "Set basic usage" {
|
||||||
const testing = std.testing;
|
const testing = std.testing;
|
||||||
const alloc = testing.allocator;
|
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);
|
const buf = try alloc.alignedAlloc(u8, Set.base_align, layout.total_size);
|
||||||
defer alloc.free(buf);
|
defer alloc.free(buf);
|
||||||
|
|
||||||
|
|
@ -397,5 +397,5 @@ test "Set basic usage" {
|
||||||
|
|
||||||
test "Set capacities" {
|
test "Set capacities" {
|
||||||
// We want to support at least this many styles without overflowing.
|
// 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());
|
try src.encode(buf_stream.writer());
|
||||||
|
|
||||||
const expected =
|
const expected =
|
||||||
"ghostty|xterm-ghostty|Ghostty\n" ++
|
"ghostty|xterm-ghostty|Ghostty,\n" ++
|
||||||
"\tam,\n" ++
|
"\tam,\n" ++
|
||||||
"\tccc@,\n" ++
|
"\tccc@,\n" ++
|
||||||
"\tcolors#256,\n" ++
|
"\tcolors#256,\n" ++
|
||||||
"\tbel=^G,\n\n";
|
"\tbel=^G,\n";
|
||||||
try std.testing.expectEqualStrings(@as([]const u8, expected), buf_stream.getWritten());
|
try std.testing.expectEqualStrings(@as([]const u8, expected), buf_stream.getWritten());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue