fix: keybind tests
This commit is contained in:
parent
a74a36b4bc
commit
271f45e78a
1 changed files with 4 additions and 4 deletions
|
@ -516,7 +516,7 @@ const parse_test_cases = .{
|
||||||
test "parse" {
|
test "parse" {
|
||||||
const alloc = std.testing.allocator;
|
const alloc = std.testing.allocator;
|
||||||
inline for (parse_test_cases) |case| {
|
inline for (parse_test_cases) |case| {
|
||||||
const parsed = try parse_vim.parse_key_events(alloc, case[0]);
|
const parsed = try parse_vim.parse_key_events(alloc, input.event.press, case[0]);
|
||||||
defer alloc.free(parsed);
|
defer alloc.free(parsed);
|
||||||
const expected: []const KeyEvent = case[1];
|
const expected: []const KeyEvent = case[1];
|
||||||
const actual: []const KeyEvent = parsed;
|
const actual: []const KeyEvent = parsed;
|
||||||
|
@ -542,10 +542,10 @@ const match_test_cases = .{
|
||||||
test "match" {
|
test "match" {
|
||||||
const alloc = std.testing.allocator;
|
const alloc = std.testing.allocator;
|
||||||
inline for (match_test_cases) |case| {
|
inline for (match_test_cases) |case| {
|
||||||
const events = try parse_vim.parse_key_events(alloc, 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, case[1]),
|
.keys = try parse_vim.parse_key_events(alloc, input.event.press, case[1]),
|
||||||
.command = undefined,
|
.command = undefined,
|
||||||
.args = undefined,
|
.args = undefined,
|
||||||
};
|
};
|
||||||
|
@ -557,7 +557,7 @@ test "match" {
|
||||||
|
|
||||||
test "json" {
|
test "json" {
|
||||||
const alloc = std.testing.allocator;
|
const alloc = std.testing.allocator;
|
||||||
var bindings = try BindingSet.init(alloc, @embedFile("keybindings.json"), "vim", "normal", "insert_chars");
|
var bindings = try BindingSet.init(alloc, "vim", "normal", "insert_chars");
|
||||||
defer bindings.deinit();
|
defer bindings.deinit();
|
||||||
_ = 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' });
|
||||||
|
|
Loading…
Add table
Reference in a new issue