diff src/testdir/test_prompt_buffer.vim @ 17976:6d11a0d5751d v8.1.1984

patch 8.1.1984: more functions can be used as methods Commit: https://github.com/vim/vim/commit/3f4f3d8e7e6fc0494d00cfb75669a554c8e67c8b Author: Bram Moolenaar <Bram@vim.org> Date: Wed Sep 4 20:05:59 2019 +0200 patch 8.1.1984: more functions can be used as methods Problem: More functions can be used as methods. Solution: Make various functions usable as a method.
author Bram Moolenaar <Bram@vim.org>
date Wed, 04 Sep 2019 20:15:04 +0200
parents ebe9aab81898
children 9c15be376631
line wrap: on
line diff
--- 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')