A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/neovim/neovim/commit/300b009f47bc617faa1c445966e2085c455e0c45 below:

handle empty reports · neovim/neovim@300b009 · GitHub

File tree Expand file treeCollapse file tree 3 files changed

+29

-1

lines changed

Filter options

Expand file treeCollapse file tree 3 files changed

+29

-1

lines changed Original file line number Diff line number Diff line change

@@ -21,10 +21,17 @@ function! health#check(plugin_names) abort

21 21

throw 'healthcheck_not_found'

22 22

endif

23 23

eval type == 'v' ? call(func, []) : luaeval(func)

24 +

" in the event the healthcheck doesn't return anything

25 +

" (the plugin author should avoid this possibility)

26 +

if len(s:output) == 0

27 +

throw 'healthcheck_no_return_value'

28 +

endif

24 29

catch

25 30

let s:output = [] " Clear the output

26 31

if v:exception =~# 'healthcheck_not_found'

27 32

call health#report_error('No healthcheck found for "'.name.'" plugin.')

33 +

elseif v:exception =~# 'healthcheck_no_return_value'

34 +

call health#report_error('The healthcheck report for "'.name.'" plugin is empty.')

28 35

else

29 36

call health#report_error(printf(

30 37

\ "Failed to run healthcheck for \"%s\" plugin. Exception:\n%s\n%s",

@@ -127,7 +134,7 @@ endfunction " }}}

127 134 128 135

" From a path return a list [{name}, {func}, {type}] representing a healthcheck

129 136

function! s:filepath_to_healthcheck(path) abort

130 -

if a:path =~# 'vim$'

137 +

if a:path =~# 'vim$'

131 138

let name = matchstr(a:path, '\zs[^\/]*\ze\.vim$')

132 139

let func = 'health#'.name.'#check'

133 140

let type = 'v'

Original file line number Diff line number Diff line change

@@ -0,0 +1,7 @@

1 +

local M = {}

2 + 3 +

M.check = function()

4 +

return {}

5 +

end

6 + 7 +

return M

Original file line number Diff line number Diff line change

@@ -153,6 +153,10 @@ describe('health.vim', function()

153 153

## report 2

154 154

- OK: nothing to see here

155 155 156 +

test_plug.submodule_empty: require("test_plug.submodule_empty.health").check()

157 +

========================================================================

158 +

- ERROR: The healthcheck report for "test_plug.submodule_empty" plugin is empty.

159 + 156 160

test_plug.submodule_failed: require("test_plug.submodule_failed.health").check()

157 161

========================================================================

158 162

- ERROR: Failed to run healthcheck for "test_plug.submodule_failed" plugin. Exception:

@@ -172,6 +176,16 @@ describe('health.vim', function()

172 176

]])

173 177

end)

174 178 179 +

it("... including empty reports", function()

180 +

command("checkhealth test_plug.submodule_empty")

181 +

helpers.expect([[

182 + 183 +

test_plug.submodule_empty: require("test_plug.submodule_empty.health").check()

184 +

========================================================================

185 +

- ERROR: The healthcheck report for "test_plug.submodule_empty" plugin is empty.

186 +

]])

187 +

end)

188 + 175 189

it("gracefully handles broken lua healthcheck", function()

176 190

command("checkhealth test_plug.submodule_failed")

177 191

local buf_lines = helpers.curbuf('get_lines', 0, -1, true)

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4