mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
65fb622000
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.
57 lines
1.6 KiB
Lua
57 lines
1.6 KiB
Lua
-- Tests for "r<Tab>" with 'smarttab' and 'expandtab' set/not set.
|
||
-- Also test that dv_ works correctly
|
||
|
||
local helpers = require('test.functional.helpers')(after_each)
|
||
local feed, insert = helpers.feed, helpers.insert
|
||
local clear, feed_command, expect = helpers.clear, helpers.feed_command, helpers.expect
|
||
|
||
describe([[performing "r<Tab>" with 'smarttab' and 'expandtab' set/not set, and "dv_"]], function()
|
||
setup(clear)
|
||
|
||
it('is working', function()
|
||
insert([[
|
||
start text
|
||
some test text
|
||
test text
|
||
other test text
|
||
a cde
|
||
f ghi
|
||
test text
|
||
Second line beginning with whitespace]])
|
||
|
||
feed_command('set smarttab expandtab ts=8 sw=4')
|
||
-- Make sure that backspace works, no matter what termcap is used.
|
||
feed_command('set t_kD=x7f t_kb=x08')
|
||
|
||
feed_command('/some')
|
||
feed('r ')
|
||
feed_command('set noexpandtab')
|
||
feed_command('/other')
|
||
feed('r <cr>')
|
||
-- Test replacing with Tabs and then backspacing to undo it.
|
||
feed('0wR <bs><bs><bs><esc><cr>')
|
||
-- Test replacing with Tabs.
|
||
feed('0wR <esc><cr>')
|
||
-- Test that copyindent works with expandtab set.
|
||
feed_command('set expandtab smartindent copyindent ts=8 sw=8 sts=8')
|
||
feed('o{<cr>x<esc>')
|
||
feed_command('set nosol')
|
||
feed_command('/Second line/')
|
||
-- Test "dv_"
|
||
feed('fwdv_')
|
||
|
||
-- Assert buffer contents.
|
||
expect([[
|
||
start text
|
||
ome test text
|
||
test text
|
||
ther test text
|
||
a cde
|
||
hi
|
||
test text
|
||
{
|
||
x
|
||
with whitespace]])
|
||
end)
|
||
end)
|