aboutsummaryrefslogtreecommitdiff
path: root/test/functional/legacy/096_location_list_spec.lua
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-04-09 00:12:26 +0300
committerZyX <kp-pav@yandex.ru>2017-04-09 03:24:08 +0300
commit65fb622000af8e3dbb65480e1581758ecf4ba3e2 (patch)
tree7d83429d3762b1f0a44d04eb8fc780eedc0ec049 /test/functional/legacy/096_location_list_spec.lua
parent9158cc171f46ebae0a0d3d1721aa5b7d829bcba5 (diff)
downloadrneovim-65fb622000af8e3dbb65480e1581758ecf4ba3e2.tar.gz
rneovim-65fb622000af8e3dbb65480e1581758ecf4ba3e2.tar.bz2
rneovim-65fb622000af8e3dbb65480e1581758ecf4ba3e2.zip
functests: Replace execute with either command or feed_command
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.
Diffstat (limited to 'test/functional/legacy/096_location_list_spec.lua')
-rw-r--r--test/functional/legacy/096_location_list_spec.lua138
1 files changed, 69 insertions, 69 deletions
diff --git a/test/functional/legacy/096_location_list_spec.lua b/test/functional/legacy/096_location_list_spec.lua
index eac8d6356d..908551f060 100644
--- a/test/functional/legacy/096_location_list_spec.lua
+++ b/test/functional/legacy/096_location_list_spec.lua
@@ -8,7 +8,7 @@
local helpers = require('test.functional.helpers')(after_each)
local source = helpers.source
-local clear, execute, expect = helpers.clear, helpers.execute, helpers.expect
+local clear, command, expect = helpers.clear, helpers.command, helpers.expect
describe('location list', function()
setup(clear)
@@ -28,7 +28,7 @@ describe('location list', function()
function! ReadTestProtocol(name)
let base = substitute(a:name, '\v^test://(.*)%(\.[^.]+)?', '\1', '')
let word = substitute(base, '\v(.*)\..*', '\1', '')
-
+
setl modifiable
setl noreadonly
setl noswapfile
@@ -37,9 +37,9 @@ describe('location list', function()
" For problem 2:
" 'buftype' has to be set to reproduce the constant opening of new windows.
setl buftype=nofile
-
+
call setline(1, word)
-
+
setl nomodified
setl nomodifiable
setl readonly
@@ -71,74 +71,74 @@ describe('location list', function()
]])
-- Set up the result buffer "test.out".
- execute('enew')
- execute('w! test.out')
- execute('b 1')
+ command('enew')
+ command('w! test.out')
+ command('b 1')
-- Test A.
-- Open a new buffer as the sole window, rewind and open the prepopulated
-- location list and navigate through the entries.
- execute('lrewind')
- execute('enew')
- execute('lopen')
- execute('lnext', 'lnext', 'lnext', 'lnext')
+ command('lrewind')
+ command('enew')
+ command('lopen')
+ command('lnext', 'lnext', 'lnext', 'lnext')
-- Split the window, copying the location list, then open the copied
-- location list and again navigate forward.
- execute('vert split')
- execute('wincmd L')
- execute('lopen')
- execute('wincmd p')
- execute('lnext')
+ command('vert split')
+ command('wincmd L')
+ command('lopen')
+ command('wincmd p')
+ command('lnext')
-- Record the current file name and the file name of the corresponding
-- location list entry, then open the result buffer.
- execute('let fileName = expand("%")')
- execute('wincmd p')
- execute([[let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '')]])
- execute('wincmd n')
- execute('wincmd K')
- execute('b test.out')
+ command('let fileName = expand("%")')
+ command('wincmd p')
+ command([[let locationListFileName = substitute(getline(line('.')), '\([^|]*\)|.*', '\1', '')]])
+ command('wincmd n')
+ command('wincmd K')
+ command('b test.out')
-- Prepare test output and write it to the result buffer.
- execute([[let fileName = substitute(fileName, '\\', '/', 'g')]])
- execute([[let locationListFileName = substitute(locationListFileName, '\\', '/', 'g')]])
- execute([[call append(line('$'), "Test A:")]])
- execute([[call append(line('$'), " - file name displayed: " . fileName)]])
- execute([[call append(line('$'), " - quickfix claims that the file name displayed is: " . locationListFileName)]])
- execute('w')
+ command([[let fileName = substitute(fileName, '\\', '/', 'g')]])
+ command([[let locationListFileName = substitute(locationListFileName, '\\', '/', 'g')]])
+ command([[call append(line('$'), "Test A:")]])
+ command([[call append(line('$'), " - file name displayed: " . fileName)]])
+ command([[call append(line('$'), " - quickfix claims that the file name displayed is: " . locationListFileName)]])
+ command('w')
-- Clean slate for the next test.
- execute('wincmd o')
- execute('b 1')
+ command('wincmd o')
+ command('b 1')
-- Test B.
-- Rewind the location list, then open it and browse through it by running
-- ":{number}" followed by Enter repeatedly in the location list window.
- execute('lrewind')
- execute('lopen')
- execute('2', [[exe "normal \\<CR>"]])
- execute('wincmd p')
- execute('3', [[exe "normal \<CR>"]])
- execute('wincmd p')
- execute('4', [[exe "normal \<CR>"]])
+ command('lrewind')
+ command('lopen')
+ command('2', [[exe "normal \\<CR>"]])
+ command('wincmd p')
+ command('3', [[exe "normal \<CR>"]])
+ command('wincmd p')
+ command('4', [[exe "normal \<CR>"]])
-- Record the number of windows open, then go back to the result buffer.
- execute('let numberOfWindowsOpen = winnr("$")')
- execute('wincmd n')
- execute('wincmd K')
- execute('b test.out')
+ command('let numberOfWindowsOpen = winnr("$")')
+ command('wincmd n')
+ command('wincmd K')
+ command('b test.out')
-- Prepare test output and write it to the result buffer.
- execute('call append(line("$"), "Test B:")')
- execute('call append(line("$"), " - number of window open: " . numberOfWindowsOpen)')
- execute('w')
+ command('call append(line("$"), "Test B:")')
+ command('call append(line("$"), " - number of window open: " . numberOfWindowsOpen)')
+ command('w')
-- Clean slate.
- execute('wincmd o')
- execute('b 1')
+ command('wincmd o')
+ command('b 1')
-- Test C.
@@ -146,38 +146,38 @@ describe('location list', function()
-- Enter browsing. But this time, move the location list window to the top
-- to check whether it (the first window found) will be reused when we try
-- to open new windows.
- execute('lrewind')
- execute('lopen')
- execute('wincmd K')
- execute('2', [[exe "normal \<CR>"]])
- execute('wincmd p')
- execute('3', [[exe "normal \<CR>"]])
- execute('wincmd p')
- execute('4', [[exe "normal \<CR>"]])
+ command('lrewind')
+ command('lopen')
+ command('wincmd K')
+ command('2', [[exe "normal \<CR>"]])
+ command('wincmd p')
+ command('3', [[exe "normal \<CR>"]])
+ command('wincmd p')
+ command('4', [[exe "normal \<CR>"]])
-- Record the 'buftype' of window 1 (the location list) and the buffer name
-- of window 2 (the current "test protocol" buffer), then go back to the
-- result buffer.
- execute('1wincmd w')
- execute('let locationListWindowBufType = &buftype')
- execute('2wincmd w')
- execute('let bufferName = expand("%")')
- execute('wincmd n')
- execute('wincmd K')
- execute('b test.out')
+ command('1wincmd w')
+ command('let locationListWindowBufType = &buftype')
+ command('2wincmd w')
+ command('let bufferName = expand("%")')
+ command('wincmd n')
+ command('wincmd K')
+ command('b test.out')
-- Prepare test output and write it to the result buffer.
- execute([[let bufferName = substitute(bufferName, '\\', '/', 'g')]])
- execute([[call append(line("$"), "Test C:")]])
- execute([[call append(line('$'), " - 'buftype' of the location list window: " . locationListWindowBufType)]])
- execute([[call append(line('$'), " - buffer displayed in the 2nd window: " . bufferName)]])
- execute('w')
- execute('wincmd o')
- execute('b 1')
+ command([[let bufferName = substitute(bufferName, '\\', '/', 'g')]])
+ command([[call append(line("$"), "Test C:")]])
+ command([[call append(line('$'), " - 'buftype' of the location list window: " . locationListWindowBufType)]])
+ command([[call append(line('$'), " - buffer displayed in the 2nd window: " . bufferName)]])
+ command('w')
+ command('wincmd o')
+ command('b 1')
-- Assert buffer contents.
expect([[
-
+
Test A:
- file name displayed: test://bar.txt
- quickfix claims that the file name displayed is: test://bar.txt