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/editor/jump_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/editor/jump_spec.lua')
-rw-r--r-- | test/functional/editor/jump_spec.lua | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/test/functional/editor/jump_spec.lua b/test/functional/editor/jump_spec.lua index 9e7158e2f7..d09c20f226 100644 --- a/test/functional/editor/jump_spec.lua +++ b/test/functional/editor/jump_spec.lua @@ -5,7 +5,7 @@ local command = helpers.command local eq = helpers.eq local funcs = helpers.funcs local feed = helpers.feed -local redir_exec = helpers.redir_exec +local exec_capture = helpers.exec_capture local write_file = helpers.write_file describe('jumplist', function() @@ -78,7 +78,7 @@ describe("jumpoptions=stack behaves like 'tagstack'", function() feed('<C-O>') feed('<C-O>') - eq( '\n' + eq( '' .. ' jump line col file/text\n' .. ' 4 102 0 \n' .. ' 3 1 0 Line 1\n' @@ -87,11 +87,11 @@ describe("jumpoptions=stack behaves like 'tagstack'", function() .. '> 0 30 0 Line 30\n' .. ' 1 40 0 Line 40\n' .. ' 2 50 0 Line 50', - redir_exec('jumps')) + exec_capture('jumps')) feed('90gg') - eq( '\n' + eq( '' .. ' jump line col file/text\n' .. ' 5 102 0 \n' .. ' 4 1 0 Line 1\n' @@ -99,14 +99,14 @@ describe("jumpoptions=stack behaves like 'tagstack'", function() .. ' 2 20 0 Line 20\n' .. ' 1 30 0 Line 30\n' .. '>', - redir_exec('jumps')) + exec_capture('jumps')) end) it('does not add the same location twice adjacently', function() feed('60gg') feed('60gg') - eq( '\n' + eq( '' .. ' jump line col file/text\n' .. ' 7 102 0 \n' .. ' 6 1 0 Line 1\n' @@ -116,14 +116,14 @@ describe("jumpoptions=stack behaves like 'tagstack'", function() .. ' 2 40 0 Line 40\n' .. ' 1 50 0 Line 50\n' .. '>', - redir_exec('jumps')) + exec_capture('jumps')) end) it('does add the same location twice nonadjacently', function() feed('10gg') feed('20gg') - eq( '\n' + eq( '' .. ' jump line col file/text\n' .. ' 8 102 0 \n' .. ' 7 1 0 Line 1\n' @@ -134,6 +134,6 @@ describe("jumpoptions=stack behaves like 'tagstack'", function() .. ' 2 50 0 Line 50\n' .. ' 1 10 0 Line 10\n' .. '>', - redir_exec('jumps')) + exec_capture('jumps')) end) end) |