comparison src/testdir/test_put.vim @ 26137:14a55d1520f2 v8.2.3601

patch 8.2.3601: check for overflow in put count does not work well Commit: https://github.com/vim/vim/commit/fa53722367c3793fda95dac665af74b8651065e9 Author: ichizok <gclient.gaap@gmail.com> Date: Tue Nov 16 12:50:46 2021 +0000 patch 8.2.3601: check for overflow in put count does not work well Problem: Check for overflow in put count does not work well. Solution: Improve the overflow check. (Ozaki Kiichi, closes https://github.com/vim/vim/issues/9102)
author Bram Moolenaar <Bram@vim.org>
date Tue, 16 Nov 2021 14:00:04 +0100
parents e353ace59e62
children 164db42130ec
comparison
equal deleted inserted replaced
26136:8492808608d5 26137:14a55d1520f2
147 147
148 bwipe! 148 bwipe!
149 endfunc 149 endfunc
150 150
151 func Test_very_large_count() 151 func Test_very_large_count()
152 if v:sizeofint != 8 152 new
153 throw 'Skipped: only works with 64 bit ints' 153 " total put-length (21474837 * 100) brings 32 bit int overflow
154 let @" = repeat('x', 100)
155 call assert_fails('norm 21474837p', 'E1240:')
156 bwipe!
157 endfunc
158
159 func Test_very_large_count_64bit()
160 if v:sizeoflong < 8
161 throw 'Skipped: only works with 64 bit long ints'
154 endif 162 endif
155 163
156 new 164 new
157 let @" = 'x' 165 let @" = 'x'
166 call assert_fails('norm 44444444444444p', 'E1240:')
167 bwipe!
168 endfunc
169
170 func Test_very_large_count_block()
171 new
172 " total put-length (21474837 * 100) brings 32 bit int overflow
173 call setline(1, repeat('x', 100))
174 exe "norm \<C-V>99ly"
175 call assert_fails('norm 21474837p', 'E1240:')
176 bwipe!
177 endfunc
178
179 func Test_very_large_count_block_64bit()
180 if v:sizeoflong < 8
181 throw 'Skipped: only works with 64 bit long ints'
182 endif
183
184 new
185 call setline(1, 'x')
186 exe "norm \<C-V>y"
158 call assert_fails('norm 44444444444444p', 'E1240:') 187 call assert_fails('norm 44444444444444p', 'E1240:')
159 bwipe! 188 bwipe!
160 endfunc 189 endfunc
161 190
162 func Test_put_above_first_line() 191 func Test_put_above_first_line()