diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-03-26 10:49:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-26 10:49:32 +0800 |
commit | 4863ca6b8902c5b0aab95f2af640118cd417d379 (patch) | |
tree | 41a1ecb32984dc88f25df722abaf3ba381db3cf3 /test/functional/core | |
parent | 4eef5ac453866dae7c03f5432fc8c4dfcda19f54 (diff) | |
download | rneovim-4863ca6b8902c5b0aab95f2af640118cd417d379.tar.gz rneovim-4863ca6b8902c5b0aab95f2af640118cd417d379.tar.bz2 rneovim-4863ca6b8902c5b0aab95f2af640118cd417d379.zip |
test: use exec_capture() in more places (#22787)
Problem:
Using `meths.exec2("code", { output = true })` is too verbose.
Solution:
Use exec_capture() in more places.
Diffstat (limited to 'test/functional/core')
-rw-r--r-- | test/functional/core/remote_spec.lua | 6 | ||||
-rw-r--r-- | test/functional/core/startup_spec.lua | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/test/functional/core/remote_spec.lua b/test/functional/core/remote_spec.lua index b2a1679023..f74bb65553 100644 --- a/test/functional/core/remote_spec.lua +++ b/test/functional/core/remote_spec.lua @@ -3,11 +3,11 @@ local helpers = require('test.functional.helpers')(after_each) local clear = helpers.clear local command = helpers.command local eq = helpers.eq +local exec_capture = helpers.exec_capture local exec_lua = helpers.exec_lua local expect = helpers.expect local funcs = helpers.funcs local insert = helpers.insert -local meths = helpers.meths local new_argv = helpers.new_argv local neq = helpers.neq local set_session = helpers.set_session @@ -101,7 +101,7 @@ describe('Remote', function() expect(contents) eq(1, #funcs.getbufinfo()) -- Since we didn't pass silent, we should get a complaint - neq(nil, string.find(meths.exec2('messages', { output = true }).output, 'E247')) + neq(nil, string.find(exec_capture('messages'), 'E247:')) end) it('creates server if not found with tabs', function() @@ -110,7 +110,7 @@ describe('Remote', function() eq(2, #funcs.gettabinfo()) eq(2, #funcs.getbufinfo()) -- We passed silent, so no message should be issued about the server not being found - eq(nil, string.find(meths.exec2('messages', { output = true }).output, 'E247')) + eq(nil, string.find(exec_capture('messages'), 'E247:')) end) pending('exits with error on', function() diff --git a/test/functional/core/startup_spec.lua b/test/functional/core/startup_spec.lua index 4ae8b1c95e..cc94623df3 100644 --- a/test/functional/core/startup_spec.lua +++ b/test/functional/core/startup_spec.lua @@ -9,6 +9,7 @@ local ok = helpers.ok local eq = helpers.eq local matches = helpers.matches local eval = helpers.eval +local exec_capture = helpers.exec_capture local exec_lua = helpers.exec_lua local feed = helpers.feed local funcs = helpers.funcs @@ -823,7 +824,7 @@ describe('user config init', function() clear{ args_rm={'-u'}, env=xenv } feed('<cr><c-c>') -- Dismiss "Conflicting config …" message. eq(1, eval('g:lua_rc')) - matches('^E5422: Conflicting configs', meths.exec2('messages', { output = true }).output) + matches('^E5422: Conflicting configs', exec_capture('messages')) end) end) end) @@ -872,7 +873,7 @@ describe('runtime:', function() eq(2, eval('g:lua_plugin')) -- Check if plugin_file_path is listed in :scriptname - local scripts = meths.exec2(':scriptnames', { output = true }).output + local scripts = exec_capture('scriptnames') assert(scripts:find(plugin_file_path)) -- Check if plugin_file_path is listed in startup profile |