mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-19 18:26:13 +03:00
terminal/new: style tests
This commit is contained in:
@ -161,30 +161,33 @@ test {
|
|||||||
_ = Set;
|
_ = Set;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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.layoutForCapacity(0, 16);
|
const layout = Set.layoutForCapacity(0, 16);
|
||||||
// const buf = try alloc.alloc(u8, layout.total_size);
|
const buf = try alloc.alloc(u8, layout.total_size);
|
||||||
// defer alloc.free(buf);
|
defer alloc.free(buf);
|
||||||
//
|
|
||||||
// const style: Style = .{ .flags = .{ .bold = true } };
|
const style: Style = .{ .flags = .{ .bold = true } };
|
||||||
//
|
|
||||||
// var set = Set.init(buf, layout);
|
var set = Set.init(buf, layout);
|
||||||
//
|
|
||||||
// // Upsert
|
// Upsert
|
||||||
// const meta = try set.upsert(buf, style);
|
const meta = try set.upsert(buf, style);
|
||||||
// try testing.expect(meta.id > 0);
|
try testing.expect(meta.id > 0);
|
||||||
//
|
|
||||||
// // Second upsert should return the same metadata.
|
// Second upsert should return the same metadata.
|
||||||
// {
|
{
|
||||||
// const meta2 = try set.upsert(buf, style);
|
const meta2 = try set.upsert(buf, style);
|
||||||
// try testing.expectEqual(meta.id, meta2.id);
|
try testing.expectEqual(meta.id, meta2.id);
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// // Look it up
|
// Look it up
|
||||||
// {
|
{
|
||||||
// const v = set.lookupId(buf, meta.id).?;
|
const v = set.lookupId(buf, meta.id).?;
|
||||||
// try testing.expect(v.flags.bold);
|
try testing.expect(v.flags.bold);
|
||||||
// }
|
|
||||||
// }
|
const v2 = set.lookupId(buf, meta.id).?;
|
||||||
|
try testing.expectEqual(v, v2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user