blob: d2ce80efda55ca43e4a49f5584add723f1024477 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
local n = require('test.functional.testnvim')()
local Screen = require('test.functional.ui.screen')
local clear = n.clear
local command = n.command
local expect = n.expect
local feed = n.feed
local sleep = vim.uv.sleep
before_each(clear)
describe('edit', function()
-- oldtest: Test_autoindent_remove_indent()
it('autoindent removes indent when Insert mode is stopped', function()
command('set autoindent')
-- leaving insert mode in a new line with indent added by autoindent, should
-- remove the indent.
feed('i<Tab>foo<CR><Esc>')
-- Need to delay for sometime, otherwise the code in getchar.c will not be
-- exercised.
sleep(50)
-- when a line is wrapped and the cursor is at the start of the second line,
-- leaving insert mode, should move the cursor back to the first line.
feed('o' .. ('x'):rep(20) .. '<Esc>')
-- Need to delay for sometime, otherwise the code in getchar.c will not be
-- exercised.
sleep(50)
expect('\tfoo\n\n' .. ('x'):rep(20))
end)
-- oldtest: Test_edit_insert_reg()
it('inserting a register using CTRL-R', function()
local screen = Screen.new(10, 6)
feed('a<C-R>')
screen:expect([[
{18:^"} |
{1:~ }|*4
{5:-- INSERT --}|
]])
feed('=')
screen:expect([[
{18:"} |
{1:~ }|*4
=^ |
]])
feed([['r'<CR><Esc>]])
expect('r')
-- Test for inserting null and empty list
feed('a<C-R>=v:_null_list<CR><Esc>')
feed('a<C-R>=[]<CR><Esc>')
expect('r')
end)
-- oldtest: Test_edit_ctrl_r_failed()
it('positioning cursor after CTRL-R expression failed', function()
local screen = Screen.new(60, 6)
feed('i<C-R>')
screen:expect([[
{18:^"} |
{1:~ }|*4
{5:-- INSERT --} |
]])
feed('=0z')
screen:expect([[
{18:"} |
{1:~ }|*4
={26:0}{9:z}^ |
]])
-- trying to insert a blob produces an error
feed('<CR>')
screen:expect([[
{18:"} |
{1:~ }|
{3: }|
={26:0}{9:z} |
{9:E976: Using a Blob as a String} |
{6:Press ENTER or type command to continue}^ |
]])
feed(':')
screen:expect([[
:^ |
{1:~ }|*4
{5:-- INSERT --} |
]])
-- ending Insert mode should put the cursor back on the ':'
feed('<Esc>')
screen:expect([[
^: |
{1:~ }|*4
|
]])
end)
end)
|