diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-09-04 20:05:59 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-09-04 20:05:59 +0200 |
commit | 3f4f3d8e7e6fc0494d00cfb75669a554c8e67c8b (patch) | |
tree | ac8bdd089ce9a96e2e96033410b88b1836425a28 /src/testdir/test_prompt_buffer.vim | |
parent | ea781459b9617aa47335061fcc78403495260315 (diff) | |
download | vim-git-3f4f3d8e7e6fc0494d00cfb75669a554c8e67c8b.tar.gz |
patch 8.1.1984: more functions can be used as methodsv8.1.1984
Problem: More functions can be used as methods.
Solution: Make various functions usable as a method.
Diffstat (limited to 'src/testdir/test_prompt_buffer.vim')
-rw-r--r-- | src/testdir/test_prompt_buffer.vim | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/testdir/test_prompt_buffer.vim b/src/testdir/test_prompt_buffer.vim index 028f3371e..199c1c298 100644 --- a/src/testdir/test_prompt_buffer.vim +++ b/src/testdir/test_prompt_buffer.vim @@ -48,6 +48,7 @@ func WriteScript(name) \ 'new', \ 'set buftype=prompt', \ 'call prompt_setcallback(bufnr(""), function("TextEntered"))', + \ 'eval bufnr("")->prompt_setprompt("cmd: ")', \ 'startinsert', \ ], a:name) endfunc @@ -60,10 +61,10 @@ func Test_prompt_basic() call WriteScript(scriptName) let buf = RunVimInTerminal('-S ' . scriptName, {}) - call WaitForAssert({-> assert_equal('%', term_getline(buf, 1))}) + call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))}) call term_sendkeys(buf, "hello\<CR>") - call WaitForAssert({-> assert_equal('% hello', term_getline(buf, 1))}) + call WaitForAssert({-> assert_equal('cmd: hello', term_getline(buf, 1))}) call WaitForAssert({-> assert_equal('Command: "hello"', term_getline(buf, 2))}) call WaitForAssert({-> assert_equal('Result: "hello"', term_getline(buf, 3))}) @@ -82,19 +83,19 @@ func Test_prompt_editing() call WriteScript(scriptName) let buf = RunVimInTerminal('-S ' . scriptName, {}) - call WaitForAssert({-> assert_equal('%', term_getline(buf, 1))}) + call WaitForAssert({-> assert_equal('cmd:', term_getline(buf, 1))}) let bs = "\<BS>" call term_sendkeys(buf, "hello" . bs . bs) - call WaitForAssert({-> assert_equal('% hel', term_getline(buf, 1))}) + call WaitForAssert({-> assert_equal('cmd: hel', term_getline(buf, 1))}) let left = "\<Left>" call term_sendkeys(buf, left . left . left . bs . '-') - call WaitForAssert({-> assert_equal('% -hel', term_getline(buf, 1))}) + call WaitForAssert({-> assert_equal('cmd: -hel', term_getline(buf, 1))}) let end = "\<End>" call term_sendkeys(buf, end . "x") - call WaitForAssert({-> assert_equal('% -helx', term_getline(buf, 1))}) + call WaitForAssert({-> assert_equal('cmd: -helx', term_getline(buf, 1))}) call term_sendkeys(buf, "\<C-U>exit\<CR>") call WaitForAssert({-> assert_equal('other buffer', term_getline(buf, 1))}) @@ -113,8 +114,8 @@ func Test_prompt_garbage_collect() new set buftype=prompt - call prompt_setcallback(bufnr(''), function('MyPromptCallback', [{}])) - call prompt_setinterrupt(bufnr(''), function('MyPromptInterrupt', [{}])) + eval bufnr('')->prompt_setcallback(function('MyPromptCallback', [{}])) + eval bufnr('')->prompt_setinterrupt(function('MyPromptInterrupt', [{}])) call test_garbagecollect_now() " Must not crash call feedkeys("\<CR>\<C-C>", 'xt') |