annotate src/testdir/test_prompt_buffer.vim @ 19896:92177b596695 v8.2.0504

patch 8.2.0504: Vim9: leaking scope memory when compilation fails Commit: https://github.com/vim/vim/commit/3cca299520a4980fd1b124564bd67782ca977c15 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Apr 2 22:57:36 2020 +0200 patch 8.2.0504: Vim9: leaking scope memory when compilation fails Problem: Vim9: leaking scope memory when compilation fails. Solution: Cleanup the scope list.
author Bram Moolenaar <Bram@vim.org>
date Thu, 02 Apr 2020 23:00:03 +0200
parents 12518b40c161
children 16460964c304
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for setting 'buftype' to "prompt"
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
17089
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
3 source check.vim
8e9e9124c7a2 patch 8.1.1544: some balloon tests don't run when they can
Bram Moolenaar <Bram@vim.org>
parents: 17049
diff changeset
4 CheckFeature channel
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 source shared.vim
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 source screendump.vim
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
9 func CanTestPromptBuffer()
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 " We need to use a terminal window to be able to feed keys without leaving
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 " Insert mode.
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 if !has('terminal')
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
13 return 0
14021
945d343d3024 patch 8.1.0028: prompt buffer test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14019
diff changeset
14 endif
945d343d3024 patch 8.1.0028: prompt buffer test fails on MS-Windows
Christian Brabandt <cb@256bit.org>
parents: 14019
diff changeset
15 if has('win32')
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
16 " TODO: make the tests work on MS-Windows
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
17 return 0
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18 endif
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
19 return 1
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
20 endfunc
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
21
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
22 func WriteScript(name)
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 call writefile([
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 \ 'func TextEntered(text)',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
25 \ ' if a:text == "exit"',
14149
fba38a3491f5 patch 8.1.0092: prompt buffer test fails
Christian Brabandt <cb@256bit.org>
parents: 14029
diff changeset
26 \ ' " Reset &modified to allow the buffer to be closed.',
fba38a3491f5 patch 8.1.0092: prompt buffer test fails
Christian Brabandt <cb@256bit.org>
parents: 14029
diff changeset
27 \ ' set nomodified',
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 \ ' stopinsert',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
29 \ ' close',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
30 \ ' else',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 \ ' " Add the output above the current prompt.',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32 \ ' call append(line("$") - 1, "Command: \"" . a:text . "\"")',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
33 \ ' " Reset &modified to allow the buffer to be closed.',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 \ ' set nomodified',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 \ ' call timer_start(20, {id -> TimerFunc(a:text)})',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 \ ' endif',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 \ 'endfunc',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 \ '',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39 \ 'func TimerFunc(text)',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 \ ' " Add the output above the current prompt.',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41 \ ' call append(line("$") - 1, "Result: \"" . a:text . "\"")',
14025
eb5ee7479d31 patch 8.1.0030: stoping Vim running in a terminal may not work
Christian Brabandt <cb@256bit.org>
parents: 14021
diff changeset
42 \ ' " Reset &modified to allow the buffer to be closed.',
eb5ee7479d31 patch 8.1.0030: stoping Vim running in a terminal may not work
Christian Brabandt <cb@256bit.org>
parents: 14021
diff changeset
43 \ ' set nomodified',
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 \ 'endfunc',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 \ '',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46 \ 'call setline(1, "other buffer")',
14025
eb5ee7479d31 patch 8.1.0030: stoping Vim running in a terminal may not work
Christian Brabandt <cb@256bit.org>
parents: 14021
diff changeset
47 \ 'set nomodified',
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 \ 'new',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49 \ 'set buftype=prompt',
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 \ 'call prompt_setcallback(bufnr(""), function("TextEntered"))',
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
51 \ 'eval bufnr("")->prompt_setprompt("cmd: ")',
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 \ 'startinsert',
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
53 \ ], a:name)
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
54 endfunc
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
55
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
56 func Test_prompt_basic()
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
57 if !CanTestPromptBuffer()
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
58 return
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
59 endif
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
60 let scriptName = 'XpromptscriptBasic'
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
61 call WriteScript(scriptName)
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
62
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
63 let buf = RunVimInTerminal('-S ' . scriptName, {})
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
64 call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))})
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
66 call term_sendkeys(buf, "hello\<CR>")
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
67 call WaitForAssert({-> assert_equal('cmd: hello', term_getline(buf, 1))})
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68 call WaitForAssert({-> assert_equal('Command: "hello"', term_getline(buf, 2))})
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 call WaitForAssert({-> assert_equal('Result: "hello"', term_getline(buf, 3))})
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71 call term_sendkeys(buf, "exit\<CR>")
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))})
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 call StopVimInTerminal(buf)
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
75 call delete(scriptName)
14019
dc67449d648c patch 8.1.0027: difficult to make a plugin that feeds a line to a job
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 endfunc
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
77
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
78 func Test_prompt_editing()
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
79 if !CanTestPromptBuffer()
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
80 return
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
81 endif
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
82 let scriptName = 'XpromptscriptEditing'
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
83 call WriteScript(scriptName)
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
84
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
85 let buf = RunVimInTerminal('-S ' . scriptName, {})
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
86 call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))})
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
87
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
88 let bs = "\<BS>"
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
89 call term_sendkeys(buf, "hello" . bs . bs)
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
90 call WaitForAssert({-> assert_equal('cmd: hel', term_getline(buf, 1))})
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
91
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
92 let left = "\<Left>"
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
93 call term_sendkeys(buf, left . left . left . bs . '-')
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
94 call WaitForAssert({-> assert_equal('cmd: -hel', term_getline(buf, 1))})
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
95
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
96 let end = "\<End>"
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
97 call term_sendkeys(buf, end . "x")
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
98 call WaitForAssert({-> assert_equal('cmd: -helx', term_getline(buf, 1))})
14029
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
99
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
100 call term_sendkeys(buf, "\<C-U>exit\<CR>")
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
101 call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))})
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
102
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
103 call StopVimInTerminal(buf)
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
104 call delete(scriptName)
d9fc15c833d5 patch 8.1.0032: BS in prompt buffer starts new line
Christian Brabandt <cb@256bit.org>
parents: 14025
diff changeset
105 endfunc
17151
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
106
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
107 func Test_prompt_garbage_collect()
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
108 func MyPromptCallback(x, text)
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
109 " NOP
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
110 endfunc
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
111 func MyPromptInterrupt(x)
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
112 " NOP
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
113 endfunc
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
114
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
115 new
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
116 set buftype=prompt
17976
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
117 eval bufnr('')->prompt_setcallback(function('MyPromptCallback', [{}]))
6d11a0d5751d patch 8.1.1984: more functions can be used as methods
Bram Moolenaar <Bram@vim.org>
parents: 17151
diff changeset
118 eval bufnr('')->prompt_setinterrupt(function('MyPromptInterrupt', [{}]))
17151
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
119 call test_garbagecollect_now()
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
120 " Must not crash
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
121 call feedkeys("\<CR>\<C-C>", 'xt')
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
122 call assert_true(v:true)
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
123
19852
12518b40c161 patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
124 call assert_fails("call prompt_setcallback(bufnr(), [])", 'E921:')
12518b40c161 patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
125 call assert_equal(0, prompt_setcallback({}, ''))
12518b40c161 patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
126 call assert_fails("call prompt_setinterrupt(bufnr(), [])", 'E921:')
12518b40c161 patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
127 call assert_equal(0, prompt_setinterrupt({}, ''))
12518b40c161 patch 8.2.0482: channel and sandbox code not sufficiently tested
Bram Moolenaar <Bram@vim.org>
parents: 19625
diff changeset
128
17151
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
129 delfunc MyPromptCallback
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
130 bwipe!
ebe9aab81898 patch 8.1.1575: callbacks may be garbage collected
Bram Moolenaar <Bram@vim.org>
parents: 17089
diff changeset
131 endfunc
19613
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
132
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
133 " Test for editing the prompt buffer
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
134 func Test_prompt_buffer_edit()
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
135 new
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
136 set buftype=prompt
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
137 normal! i
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
138 call assert_beeps('normal! dd')
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
139 call assert_beeps('normal! ~')
19625
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
140 call assert_beeps('normal! o')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
141 call assert_beeps('normal! O')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
142 call assert_beeps('normal! p')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
143 call assert_beeps('normal! P')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
144 call assert_beeps('normal! u')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
145 call assert_beeps('normal! ra')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
146 call assert_beeps('normal! s')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
147 call assert_beeps('normal! S')
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
148 call assert_beeps("normal! \<C-A>")
f70a3c1000bb patch 8.2.0369: various Normal mode commands not fully tested
Bram Moolenaar <Bram@vim.org>
parents: 19613
diff changeset
149 call assert_beeps("normal! \<C-X>")
19613
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
150 close!
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
151 endfunc
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
152
9c15be376631 patch 8.2.0363: some Normal mode commands not tested
Bram Moolenaar <Bram@vim.org>
parents: 17976
diff changeset
153 " vim: shiftwidth=2 sts=2 expandtab