1

Refresh generated nvim config

This commit is contained in:
2024-06-03 21:11:20 +02:00
parent fd506d4921
commit 50723ef645
2114 changed files with 84528 additions and 44473 deletions

View File

@ -307,3 +307,87 @@ describe("transform_path", function()
end, new_relpath "doc/mydoc.md", new_relpath "d/mydoc.md")
end)
end)
describe("path_tail", function()
local function assert_tails(paths)
for _, path in ipairs(paths) do
it("gets the tail of " .. path, function()
local tail = vim.fn.fnamemodify(path, ":p:t")
eq(tail, utils.path_tail(path))
end)
end
end
if jit and jit.os:lower() == "windows" then
describe("handles windows paths", function()
local paths = {
[[C:\Users\username\AppData\Local\nvim-data\log]],
[[D:\Projects\project_folder\source_code.py]],
[[E:\Music\song.mp3]],
[[/home/usuario/documents/archivo.txt]],
[[/var/www/html/index.html]],
[[/mnt/backup/backup_file.tar.gz]],
}
assert_tails(paths)
end)
elseif jit and jit.os:lower() == "linux" then
describe("handles linux paths", function()
local paths = {
[[/home/usuario/documents/archivo.txt]],
[[/var/www/html/index.html]],
[[/mnt/backup/backup_file.tar.gz]],
}
assert_tails(paths)
end)
elseif jit and jit.os:lower() == "osx" then
describe("handles macos paths", function()
local paths = {
[[/Users/Usuario/Documents/archivo.txt]],
[[/Applications/App.app/Contents/MacOS/app_executable]],
[[/Volumes/ExternalDrive/Data/file.xlsx]],
}
assert_tails(paths)
end)
end
end)
describe("split_lines", function()
local expect = {
"",
"",
"line3 of the file",
"",
"line5 of the file",
"",
"",
"line8 of the file, last line of file",
"",
}
local function get_fake_file(line_ending)
return table.concat(expect, line_ending)
end
local newline_file = get_fake_file "\n"
local carriage_newline_file = get_fake_file "\r\n"
if utils.iswin then
describe("handles files on Windows", function()
it("reads file with newline only", function()
assert.are.same(expect, utils.split_lines(newline_file))
end)
it("reads file with carriage return and newline", function()
assert.are.same(expect, utils.split_lines(carriage_newline_file))
end)
end)
else
describe("handles files on non Windows environment", function()
it("reads file with newline only", function()
assert.are.same(expect, utils.split_lines(newline_file))
end)
end)
end
end)