diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2021-09-19 02:29:37 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-19 02:29:37 -0700 |
commit | 2afbce7651f79b0626ebeae3688274ce18ac2920 (patch) | |
tree | cb1e074962bdfc8ed00bf68775fc1fa0dbca6214 /test/functional/shada/merging_spec.lua | |
parent | 924e8e4f2d88ee5c45e521e9f758b7c9f247a011 (diff) | |
download | rneovim-2afbce7651f79b0626ebeae3688274ce18ac2920.tar.gz rneovim-2afbce7651f79b0626ebeae3688274ce18ac2920.tar.bz2 rneovim-2afbce7651f79b0626ebeae3688274ce18ac2920.zip |
refactor(tests): remove redir_exec #15718
Problem
- `redir_exec` is obsolete, but it keeps getting used in new tests
because people copy existing tests.
- Disadvantages of `redir_exec`:
- Captures extra junk before the actual error/message that we _want_ to test.
- Does not fail on error, unlike e.g. `command()`.
Solution
- Use new functions like `nvim_exec` and `pcall_err`.
Diffstat (limited to 'test/functional/shada/merging_spec.lua')
-rw-r--r-- | test/functional/shada/merging_spec.lua | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/test/functional/shada/merging_spec.lua b/test/functional/shada/merging_spec.lua index 22f2b8348d..2d44b0a950 100644 --- a/test/functional/shada/merging_spec.lua +++ b/test/functional/shada/merging_spec.lua @@ -3,7 +3,7 @@ local helpers = require('test.functional.helpers')(after_each) local nvim_command, funcs, curbufmeths, eq = helpers.command, helpers.funcs, helpers.curbufmeths, helpers.eq -local exc_exec, redir_exec = helpers.exc_exec, helpers.redir_exec +local exc_exec, exec_capture = helpers.exc_exec, helpers.exec_capture local shada_helpers = require('test.functional.shada.helpers') local reset, clear, get_shada_rw = @@ -910,14 +910,13 @@ describe('ShaDa jumps support code', function() .. '\008\007\018\131\162mX\195\161f\196\006' .. mock_file_path .. 'f\161l\002') eq(0, exc_exec(sdrcmd())) eq('', curbufmeths.get_name()) - eq('\n' - .. ' jump line col file/text\n' + eq( ' jump line col file/text\n' .. ' 5 2 0 ' .. mock_file_path .. 'c\n' .. ' 4 2 0 ' .. mock_file_path .. 'd\n' .. ' 3 3 0 ' .. mock_file_path .. 'd\n' .. ' 2 2 0 ' .. mock_file_path .. 'e\n' .. ' 1 2 0 ' .. mock_file_path .. 'f\n' - .. '>', redir_exec('jumps')) + .. '>', exec_capture('jumps')) end) it('merges jumps when writing', function() @@ -1001,14 +1000,13 @@ describe('ShaDa changes support code', function() .. '\011\004\018\131\162mX\195\161f\196\006' .. mock_file_path .. 'c\161l\005' .. '\011\008\018\131\162mX\195\161f\196\006' .. mock_file_path .. 'c\161l\004') eq(0, exc_exec(sdrcmd())) - eq('\n' - .. 'change line col text\n' + eq( 'change line col text\n' .. ' 5 1 0 0\n' .. ' 4 2 0 1\n' .. ' 3 5 0 4\n' .. ' 2 3 0 2\n' .. ' 1 4 0 3\n' - .. '>', redir_exec('changes')) + .. '>', exec_capture('changes')) end) it('merges changes when writing', function() |