-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: added deps to .gitignore, fixed Windows
- Loading branch information
Showing
9 changed files
with
310 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
doc/tags | ||
deps/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
-- Borrowed from grug-far.nvim | ||
-- Used to compare screenshots without "attrs" (highlights) | ||
local M = {} | ||
|
||
---@class MiniTestScreenshot | ||
|
||
--- copied over from mini.test | ||
---@param t { text: string[], attr: string[] } | ||
---@return MiniTestScreenshot | ||
local function screenshot_new(t) | ||
local process_screen = function(arr_2d) | ||
local n_lines, n_cols = #arr_2d, #arr_2d[1] | ||
|
||
-- Prepend lines with line number of the form `01|` | ||
local n_digits = math.floor(math.log10(n_lines)) + 1 | ||
local format = string.format("%%0%dd|%%s", n_digits) | ||
local lines = {} | ||
for i = 1, n_lines do | ||
table.insert(lines, string.format(format, i, table.concat(arr_2d[i]))) | ||
end | ||
|
||
-- Make ruler | ||
local prefix = string.rep("-", n_digits) .. "|" | ||
local ruler = prefix .. ("---------|"):rep(math.ceil(0.1 * n_cols)):sub(1, n_cols) | ||
|
||
return string.format("%s\n%s", ruler, table.concat(lines, "\n")) | ||
end | ||
|
||
return setmetatable(t, { | ||
__tostring = function(x) | ||
return string.format("%s\n\n%s", process_screen(x.text), process_screen(x.attr)) | ||
end, | ||
}) | ||
end | ||
|
||
---@param s string | ||
---@return string[] | ||
local function string_to_chars(s) | ||
-- Can't use `vim.split(s, '')` because of multibyte characters | ||
local res = {} | ||
for i = 1, vim.fn.strchars(s) do | ||
table.insert(res, vim.fn.strcharpart(s, i - 1, 1)) | ||
end | ||
return res | ||
end | ||
|
||
--- gets a screenshot from given text lines and attrs | ||
--- note that length of text lines and length of attrs must match | ||
---@param text_lines string[] | ||
---@param attr_lines? string[] | ||
---@return MiniTestScreenshot | ||
function M.from_lines(text_lines, attr_lines) | ||
local attr_linez = attr_lines or {} | ||
for _ = 1, #text_lines do | ||
table.insert(attr_linez, " ") | ||
end | ||
|
||
local f = function(x) | ||
return string_to_chars(x) | ||
end | ||
return screenshot_new({ text = vim.tbl_map(f, text_lines), attr = vim.tbl_map(f, attr_linez) }) | ||
end | ||
|
||
function M.fromChildBufLines(child, buf) | ||
local lines = child.api.nvim_buf_get_lines(buf or 0, 0, -1, true) | ||
return M.from_lines(lines) | ||
end | ||
|
||
function M.fromChildScreen(child) | ||
local lines = child.lua([[ | ||
local lines = {} | ||
for i = 1, vim.o.lines do | ||
local line_text = {} | ||
for j = 1, vim.o.columns do | ||
table.insert(line_text, vim.fn.screenstring(i, j)) | ||
end | ||
table.insert(lines, table.concat(line_text)) | ||
end | ||
return lines | ||
]]) | ||
return M.from_lines(lines) | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
tests/screenshots/tests-file-ui_spec.lua---files()---defaults-with-icons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--|---------|---------|---------|---------|---------|---------|---- | ||
01| | ||
02|~ | ||
03|~ ╭───────────────────── Files ─────────────────────╮ | ||
04|~ │> 88/88 (0) │ | ||
05|~ │──────────────────────────────────────────────── │ | ||
06|~ │ :: <ctrl-g> to Disable .gitignore │ | ||
07|~ │▌ LICENSE ││ | ||
08|~ │ Makefile │ | ||
09|~ │ OPTIONS.md │ | ||
10|~ │ README-Win.md │ | ||
11|~ │ README.md │ | ||
12|~ │ autoload/fzf_lua.vim │ | ||
13|~ ╰─────────────────────────────────────────────────╯ | ||
14|~ ╭──────────────────── LICENSE ────────────────────╮ | ||
15|~ │ 1 MIT License | ||
16|~ │ 2 | ||
17|~ │ 3 Copyright (c) 2021 iBhagwan | ||
18|~ │ 4 │ | ||
19|~ │ 5 Permission is hereby granted, free of charge,│ | ||
20|~ │ 6 of this software and associated documentation│ | ||
21|~ │ 7 in the Software without restriction, includin│ | ||
22|~ ╰─────────────────────────────────────────────────╯ | ||
23|~ | ||
24|[No Name] 0,0-1 All | ||
25| | ||
26| | ||
27| | ||
28|-- TERMINAL -- 1,3 All | ||
|
||
--|---------|---------|---------|---------|---------|---------|---- | ||
01|0000000000000000000000000000000000000000000000000000000000000000 | ||
02|1111111111111111111111111111111111111111111111111111111111111111 | ||
03|1111111222222222222222222222222222222222222222222222222222111111 | ||
04|1111111234522222222222222222222222222222222222266666666622111111 | ||
05|1111111277777777777777777777777777777777777777777777777722111111 | ||
06|1111111222888888888888888888888888888888888222222222222222111111 | ||
07|111111129:;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;72111111 | ||
08|11111112:2222222222222222222222222222222222222222222222222111111 | ||
09|11111112:2222222222222222222222222222222222222222222222222111111 | ||
10|11111112:2222222222222222222222222222222222222222222222222111111 | ||
11|11111112:2222222222222222222222222222222222222222222222222111111 | ||
12|11111112:2222222222222222222222222222222222222222222222222111111 | ||
13|1111111222222222222222222222222222222222222222222222222222111111 | ||
14|1111111222222222222222222222222222222222222222222222222222111111 | ||
15|11111112<<<<222222222222222222222222222222222222222222222=111111 | ||
16|11111112<<<<222222222222222222222222222222222222222222222=111111 | ||
17|11111112<<<<222222222222222222222222222222222222222222222=111111 | ||
18|11111112<<<<2222222222222222222222222222222222222222222222111111 | ||
19|11111112<<<<2222222222222222222222222222222222222222222222111111 | ||
20|11111112<<<<2222222222222222222222222222222222222222222222111111 | ||
21|11111112<<<<2222222222222222222222222222222222222222222222111111 | ||
22|1111111222222222222222222222222222222222222222222222222222111111 | ||
23|1111111111111111111111111111111111111111111111111111111111111111 | ||
24|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | ||
25|???????????????????????????????????????????????????????????????? | ||
26|???????????????????????????????????????????????????????????????? | ||
27|???????????????????????????????????????????????????????????????? | ||
28|@@@@@@@@@@@@@@?????????????????????????????????????????????????? |
Oops, something went wrong.