repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
neovim/tests/std/ignored_spec.lua
Rawlocal ignored = require('std.ignored')
describe('std.ignored', function()
describe('filetypes_kv', function()
it('should return true for help', function()
assert.is_true(ignored.filetypes_kv['help'])
end)
it('should return true for oil', function()
assert.is_true(ignored.filetypes_kv['oil'])
end)
it('should return nil for lua (not an exact-match ignored filetype)', function()
assert.is_nil(ignored.filetypes_kv['lua'])
end)
end)
describe('buftypes_kv', function()
it('should return true for prompt', function()
assert.is_true(ignored.buftypes_kv['prompt'])
end)
it('should return true for nofile', function()
assert.is_true(ignored.buftypes_kv['nofile'])
end)
it('should return nil for terminal', function()
assert.is_nil(ignored.buftypes_kv['terminal'])
end)
end)
describe('filetypes_patterns', function()
it('should only contain entries with special regex chars', function()
local pattern = '[%^%$%*%+%.%?]'
for _, v in ipairs(ignored.filetypes_patterns) do
assert(v:find(pattern) ~= nil, string.format("'%s' should have special regex chars", v))
end
end)
it("should contain '^git.*'", function()
local found = false
for _, v in ipairs(ignored.filetypes_patterns) do
if v == '^git.*' then
found = true
break
end
end
assert.is_true(found)
end)
end)
describe('filetypes and buftypes arrays', function()
it('should have non-empty filetypes array', function()
assert.is_true(#ignored.filetypes > 0)
end)
it('should have non-empty buftypes array', function()
assert.is_true(#ignored.buftypes > 0)
end)
end)
describe('filetypes_kv integrity', function()
it('all entries in filetypes_kv should be truthy', function()
for _, ft in ipairs(ignored.filetypes) do
assert(ignored.filetypes_kv[ft], string.format("filetypes_kv['%s'] should be true", ft))
end
end)
end)
end)