Skip to content

Commit

Permalink
chore: centralize statuswin icon in tests (#108)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesmithgh authored Dec 12, 2023
1 parent e1f484b commit dfbf061
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
10 changes: 10 additions & 0 deletions tests/helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,16 @@ local function print_differences(actual, expected)
)
end

M.with_status_win = function(scrollback_buffer, width, status_win)
width = width or 89
status_win = status_win or '󰄛 󰣐 '
local _, _, first_line, rest = scrollback_buffer:find('(.-)\n(.*)')
local first_line_with_status_win = first_line
.. string.rep(' ', width - (#first_line + #status_win))
.. status_win
return first_line_with_status_win .. '\n' .. rest
end

M.assert_screen_equals = function(actual, expected, ...)
local actual_rstrip = actual:gsub('%s*\n', '\n')
local expected_rstrip = expected:gsub('%s*\n', '\n')
Expand Down
12 changes: 6 additions & 6 deletions tests/kitty-scrollback/kitty_scrollback_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ describe('kitty-scrollback.nvim', function()
[[\n]], -- enter
[[__open_ksb]],
}),
[[
$ echo meow 󰄛 󰣐 
h.with_status_win([[
$ echo meow
meow
$
]],
]]),
'kitty-scrollback.nvim content did not match the terminal screen'
)
end)
Expand All @@ -80,9 +80,9 @@ $
[[\n]], -- enter
[[__open_ksb]],
}),
[[
$ brew search a 󰄛 󰣐 
]],
h.with_status_win([[
$ brew search a
]]),
'kitty-scrollback.nvim content did not match the terminal screen'
)
end)
Expand Down

0 comments on commit dfbf061

Please sign in to comment.