Skip to content

Commit

Permalink
chore: Add more tests for encoding component
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiuser1 committed Apr 28, 2024
1 parent a38ce4f commit 8846cb0
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tests/spec/component_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,37 @@ describe('Encoding component', function()
vim.cmd('bd!')
os.remove(tmp_path)
end)
it('works with BOM and default config', function()
local opts = build_component_opts {
component_separators = { left = '', right = '' },
padding = 0,
}
local tmp_path = 'tmp.txt'
local tmp_fp = io.open(tmp_path, 'w')
tmp_fp:write('test file')
tmp_fp:close()
vim.cmd('e ' .. tmp_path)
vim.cmd('set bomb')
assert_component('encoding', opts, 'utf-8')
vim.cmd('bd!')
os.remove(tmp_path)
end)
it('works with BOM and option enabled', function()
local opts = build_component_opts {
component_separators = { left = '', right = '' },
padding = 0,
show_bomb = true
}
local tmp_path = 'tmp.txt'
local tmp_fp = io.open(tmp_path, 'w')
tmp_fp:write('test file')
tmp_fp:close()
vim.cmd('e ' .. tmp_path)
vim.cmd('set bomb')
assert_component('encoding', opts, 'utf-8 [BOM]')
vim.cmd('bd!')
os.remove(tmp_path)
end)
end)

describe('Fileformat component', function()
Expand Down

0 comments on commit 8846cb0

Please sign in to comment.