repositories / dotfiles
dotfiles
bugabingas dorkfiles
owned by admin
neovim/tests/std/dbg/kinds_spec.lua
Rawlocal kinds = require 'std.dbg.kinds'
describe('std.dbg.kinds', function()
describe('DBG_KINDS table', function()
it('should have DEBUG kind', function()
assert.is_table(kinds.DEBUG)
assert.is_string(kinds.DEBUG.icon)
assert.is_string(kinds.DEBUG.hl_group)
end)
it('should have TRACE kind', function()
assert.is_table(kinds.TRACE)
assert.is_string(kinds.TRACE.icon)
assert.is_string(kinds.TRACE.hl_group)
end)
it('should have ERROR kind', function()
assert.is_table(kinds.ERROR)
assert.is_string(kinds.ERROR.icon)
assert.is_string(kinds.ERROR.hl_group)
end)
it('should use Diagnostic highlight groups', function()
assert.is_true(kinds.DEBUG.hl_group == 'DiagnosticInfo')
assert.is_true(kinds.TRACE.hl_group == 'DiagnosticHint')
assert.is_true(kinds.ERROR.hl_group == 'DiagnosticError')
end)
it('should have non-empty icons', function()
assert.is_true(#kinds.DEBUG.icon > 0)
assert.is_true(#kinds.TRACE.icon > 0)
assert.is_true(#kinds.ERROR.icon > 0)
end)
end)
describe('get()', function()
it('should return DEBUG kind details', function()
local result = kinds.get('DEBUG')
assert.equal(kinds.DEBUG, result)
end)
it('should return TRACE kind details', function()
local result = kinds.get('TRACE')
assert.equal(kinds.TRACE, result)
end)
it('should return ERROR kind details', function()
local result = kinds.get('ERROR')
assert.equal(kinds.ERROR, result)
end)
it('should error on unknown kind', function()
local ok, err = pcall(function()
kinds.get('UNKNOWN')
end)
assert.is_false(ok)
assert.is_string(err)
end)
end)
describe('list()', function()
it('should return all kind names', function()
local result = kinds.list()
assert.is_table(result)
assert.equal(3, #result)
assert.is_true(vim.tbl_contains(result, 'DEBUG'))
assert.is_true(vim.tbl_contains(result, 'TRACE'))
assert.is_true(vim.tbl_contains(result, 'ERROR'))
end)
end)
describe('format()', function()
it('should format DEBUG kind with icon and name', function()
local result = kinds.format('DEBUG')
assert.is_string(result)
assert.is_not_nil(result:find('DEBUG'))
end)
it('should format TRACE kind with icon and name', function()
local result = kinds.format('TRACE')
assert.is_string(result)
assert.is_not_nil(result:find('TRACE'))
end)
it('should format ERROR kind with icon and name', function()
local result = kinds.format('ERROR')
assert.is_string(result)
assert.is_not_nil(result:find('ERROR'))
end)
it('should include icon in formatted output', function()
local result = kinds.format('DEBUG')
assert.is_not_nil(result:find(kinds.DEBUG.icon))
end)
it('should error on unknown kind', function()
local ok, err = pcall(function()
kinds.format('INVALID')
end)
assert.is_false(ok)
assert.is_string(err)
end)
end)
end)