fix: keybind unittests

This commit is contained in:
CJ van den Berg 2024-12-09 16:03:31 +01:00
parent 5e35824a22
commit 9856303ef6
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -728,17 +728,17 @@ test "match" {
const events = try parse_vim.parse_key_events(alloc, input.event.press, case[0]); const events = try parse_vim.parse_key_events(alloc, input.event.press, case[0]);
defer alloc.free(events); defer alloc.free(events);
const binding: Binding = .{ const binding: Binding = .{
.keys = try parse_vim.parse_key_events(alloc, input.event.press, case[1]), .key_events = try parse_vim.parse_key_events(alloc, input.event.press, case[1]),
.command = .{}, .commands = &[_]Command{},
}; };
defer alloc.free(binding.keys); defer alloc.free(binding.key_events);
try expectEqual(case[2], binding.match(events)); try expectEqual(case[2], binding.match(events));
} }
} }
test "json" { test "json" {
var bindings: BindingSet = .{}; var bindings: BindingSet = .{ .name = "test" };
_ = try bindings.process_key_event('j', .{ .key = 'j' }); _ = try bindings.process_key_event('j', .{ .key = 'j' });
_ = try bindings.process_key_event('k', .{ .key = 'k' }); _ = try bindings.process_key_event('k', .{ .key = 'k' });
_ = try bindings.process_key_event('g', .{ .key = 'g' }); _ = try bindings.process_key_event('g', .{ .key = 'g' });