Mercurial > vim
comparison src/testdir/test_put.vim @ 14202:51693b1a640e v8.1.0118
patch 8.1.0118: duplicate error message for put command
commit https://github.com/vim/vim/commit/f52f9ea8f5fb3df51a308c56f2bf66f735ef3ca7
Author: Bram Moolenaar <Bram@vim.org>
Date: Wed Jun 27 20:49:44 2018 +0200
patch 8.1.0118: duplicate error message for put command
Problem: Duplicate error message for put command.
Solution: Check return value of u_save(). (Jason Franklin)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Wed, 27 Jun 2018 21:00:07 +0200 |
parents | 830a47e48791 |
children | 1b9f3932a130 |
comparison
equal
deleted
inserted
replaced
14201:d0e504f050f0 | 14202:51693b1a640e |
---|---|
1 " Tests for put commands, e.g. ":put", "p", "gp", "P", "gP", etc. | |
1 | 2 |
2 func Test_put_block() | 3 func Test_put_block() |
3 if !has('multi_byte') | 4 if !has('multi_byte') |
4 return | 5 return |
5 endif | 6 endif |
56 norm! j0. | 57 norm! j0. |
57 norm! j0. | 58 norm! j0. |
58 call assert_equal(['A1','A2','A3','4A','5A','6A'], getline(1,'$')) | 59 call assert_equal(['A1','A2','A3','4A','5A','6A'], getline(1,'$')) |
59 bw! | 60 bw! |
60 endfunc | 61 endfunc |
62 | |
63 func Test_put_fails_when_nomodifiable() | |
64 new | |
65 set nomodifiable | |
66 | |
67 normal! yy | |
68 call assert_fails(':put', 'E21') | |
69 call assert_fails(':put!', 'E21') | |
70 call assert_fails(':normal! p', 'E21') | |
71 call assert_fails(':normal! gp', 'E21') | |
72 call assert_fails(':normal! P', 'E21') | |
73 call assert_fails(':normal! gP', 'E21') | |
74 | |
75 if has('mouse') | |
76 set mouse=n | |
77 call assert_fails('execute "normal! \<MiddleMouse>"', 'E21') | |
78 set mouse& | |
79 endif | |
80 | |
81 bwipeout! | |
82 endfunc | |
83 | |
84 " A bug was discovered where the Normal mode put commands (e.g., "p") would | |
85 " output duplicate error messages when invoked in a non-modifiable buffer. | |
86 func Test_put_p_errmsg_nodup() | |
87 new | |
88 set nomodifiable | |
89 | |
90 normal! yy | |
91 | |
92 func Capture_p_error() | |
93 redir => s:p_err | |
94 normal! p | |
95 redir END | |
96 endfunc | |
97 | |
98 silent! call Capture_p_error() | |
99 | |
100 " Error message output within a function should be three lines (the function | |
101 " name, the line number, and the error message). | |
102 call assert_equal(3, count(s:p_err, "\n")) | |
103 | |
104 delfunction Capture_p_error | |
105 bwipeout! | |
106 endfunc |