mirror of
https://github.com/neovim/neovim.git
synced 2025-09-07 03:48:18 +00:00

Hope this will make people using feed_command less likely: this hides bugs. Already found at least two: 1. msgpackparse() will show internal error: hash_add() in case of duplicate keys, though it will still work correctly. Currently silenced. 2. ttimeoutlen was spelled incorrectly, resulting in option not being set when expected. Test was still functioning somehow though. Currently fixed.
89 lines
2.5 KiB
Lua
89 lines
2.5 KiB
Lua
local helpers = require('test.functional.helpers')(after_each)
|
|
local plugin_helpers = require('test.functional.plugin.helpers')
|
|
|
|
local command = helpers.command
|
|
|
|
describe('health.vim', function()
|
|
before_each(function()
|
|
plugin_helpers.reset()
|
|
-- Provides functions:
|
|
-- health#broken#check()
|
|
-- health#success1#check()
|
|
-- health#success2#check()
|
|
command("set runtimepath+=test/functional/fixtures")
|
|
end)
|
|
|
|
it("reports", function()
|
|
helpers.source([[
|
|
let g:health_report = execute([
|
|
\ "call health#report_start('Check Bar')",
|
|
\ "call health#report_ok('Bar status')",
|
|
\ "call health#report_ok('Other Bar status')",
|
|
\ "call health#report_warn('Zub')",
|
|
\ "call health#report_start('Baz')",
|
|
\ "call health#report_warn('Zim', ['suggestion 1', 'suggestion 2'])"
|
|
\ ])
|
|
]])
|
|
local result = helpers.eval("g:health_report")
|
|
|
|
helpers.eq(helpers.dedent([[
|
|
|
|
|
|
## Check Bar
|
|
- SUCCESS: Bar status
|
|
- SUCCESS: Other Bar status
|
|
- WARNING: Zub
|
|
|
|
## Baz
|
|
- WARNING: Zim
|
|
- SUGGESTIONS:
|
|
- suggestion 1
|
|
- suggestion 2]]),
|
|
result)
|
|
end)
|
|
|
|
|
|
describe(":CheckHealth", function()
|
|
it("concatenates multiple reports", function()
|
|
command("CheckHealth success1 success2")
|
|
helpers.expect([[
|
|
|
|
health#success1#check
|
|
========================================================================
|
|
## report 1
|
|
- SUCCESS: everything is fine
|
|
|
|
## report 2
|
|
- SUCCESS: nothing to see here
|
|
|
|
health#success2#check
|
|
========================================================================
|
|
## another 1
|
|
- SUCCESS: ok
|
|
]])
|
|
end)
|
|
|
|
it("gracefully handles broken healthcheck", function()
|
|
command("CheckHealth broken")
|
|
helpers.expect([[
|
|
|
|
health#broken#check
|
|
========================================================================
|
|
- ERROR: Failed to run healthcheck for "broken" plugin. Exception:
|
|
function health#check[20]..health#broken#check, line 1
|
|
caused an error
|
|
]])
|
|
end)
|
|
|
|
it("gracefully handles invalid healthcheck", function()
|
|
command("CheckHealth non_existent_healthcheck")
|
|
helpers.expect([[
|
|
|
|
health#non_existent_healthcheck#check
|
|
========================================================================
|
|
- ERROR: No healthcheck found for "non_existent_healthcheck" plugin.
|
|
]])
|
|
end)
|
|
end)
|
|
end)
|