aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir/test_prompt_buffer.vim
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-04-14 20:13:22 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-04-21 14:55:04 +0100
commit65f35e0c7db700c25d9de9a3c8637f720c07583a (patch)
tree57ac945230ad1271c337d38256147e5f2e67bd33 /src/nvim/testdir/test_prompt_buffer.vim
parent805eb81ccdc6a7000926e458b6e0dd59df16a112 (diff)
downloadrneovim-65f35e0c7db700c25d9de9a3c8637f720c07583a.tar.gz
rneovim-65f35e0c7db700c25d9de9a3c8637f720c07583a.tar.bz2
rneovim-65f35e0c7db700c25d9de9a3c8637f720c07583a.zip
vim-patch:8.2.1588: cannot read back the prompt of a prompt buffer
Problem: Cannot read back the prompt of a prompt buffer. Solution: Add prompt_getprompt(). (Ben Jackson, closes vim/vim#6851) https://github.com/vim/vim/commit/077cc7aa0e0c431e97795612374fe17fe7c88803 Updated prompt_getprompt() doc to https://github.com/vim/vim/commit/cb80aa2d53e56d3aba3b3c439fb467f29a750c5e and removed mention of method syntax usage (not supported by Nvim).
Diffstat (limited to 'src/nvim/testdir/test_prompt_buffer.vim')
-rw-r--r--src/nvim/testdir/test_prompt_buffer.vim36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_prompt_buffer.vim b/src/nvim/testdir/test_prompt_buffer.vim
index 66647018b5..6fc5850be3 100644
--- a/src/nvim/testdir/test_prompt_buffer.vim
+++ b/src/nvim/testdir/test_prompt_buffer.vim
@@ -156,4 +156,40 @@ func Test_prompt_buffer_edit()
call assert_equal(0, prompt_setprompt([], ''))
endfunc
+func Test_prompt_buffer_getbufinfo()
+ new
+ call assert_equal('', prompt_getprompt('%'))
+ call assert_equal('', prompt_getprompt(bufnr('%')))
+ let another_buffer = bufnr('%')
+
+ set buftype=prompt
+ call assert_equal('% ', prompt_getprompt('%'))
+ call prompt_setprompt( bufnr( '%' ), 'This is a test: ' )
+ call assert_equal('This is a test: ', prompt_getprompt('%'))
+
+ call prompt_setprompt( bufnr( '%' ), '' )
+ " Nvim doesn't support method call syntax yet.
+ " call assert_equal('', '%'->prompt_getprompt())
+ call assert_equal('', prompt_getprompt('%'))
+
+ call prompt_setprompt( bufnr( '%' ), 'Another: ' )
+ call assert_equal('Another: ', prompt_getprompt('%'))
+ let another = bufnr('%')
+
+ new
+
+ call assert_equal('', prompt_getprompt('%'))
+ call assert_equal('Another: ', prompt_getprompt(another))
+
+ " Doesn't exist
+ let buffers_before = len( getbufinfo() )
+ call assert_equal('', prompt_getprompt( bufnr('$') + 1))
+ call assert_equal(buffers_before, len( getbufinfo()))
+
+ " invalid type
+ call assert_fails('call prompt_getprompt({})', 'E728:')
+
+ %bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab