aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2022-02-18 00:09:11 +0000
committerGitHub <noreply@github.com>2022-02-18 00:09:11 +0000
commit592f4a7c0807427355635eb371215036325e5bb8 (patch)
tree92a8dd9711da31c99f612ecca8bdc787ce6b9045 /src/nvim/testdir
parentdf0fae2ff7cd666947b752f76987bb6756e187da (diff)
parent41d0e7af2097e0374ab16fb1567cf22d21aad180 (diff)
downloadrneovim-592f4a7c0807427355635eb371215036325e5bb8.tar.gz
rneovim-592f4a7c0807427355635eb371215036325e5bb8.tar.bz2
rneovim-592f4a7c0807427355635eb371215036325e5bb8.zip
Merge pull request #17433 from seandewar/vim-8.2.3492
vim-patch:8.2.{3492,3493,3570,3573,3574,3575,3577,3601}: put overflow checking shenanigans
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_put.vim44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_put.vim b/src/nvim/testdir/test_put.vim
index ed76709a56..9f2fc999a7 100644
--- a/src/nvim/testdir/test_put.vim
+++ b/src/nvim/testdir/test_put.vim
@@ -138,6 +138,50 @@ func Test_p_with_count_leaves_mark_at_end()
bwipe!
endfunc
+func Test_very_large_count()
+ new
+ " total put-length (21474837 * 100) brings 32 bit int overflow
+ let @" = repeat('x', 100)
+ call assert_fails('norm 21474837p', 'E1240:')
+ bwipe!
+endfunc
+
+func Test_very_large_count_64bit()
+ throw 'Skipped: v:sizeoflong is N/A' " use legacy/put_spec.lua instead
+
+ if v:sizeoflong < 8
+ throw 'Skipped: only works with 64 bit long ints'
+ endif
+
+ new
+ let @" = 'x'
+ call assert_fails('norm 44444444444444p', 'E1240:')
+ bwipe!
+endfunc
+
+func Test_very_large_count_block()
+ new
+ " total put-length (21474837 * 100) brings 32 bit int overflow
+ call setline(1, repeat('x', 100))
+ exe "norm \<C-V>99ly"
+ call assert_fails('norm 21474837p', 'E1240:')
+ bwipe!
+endfunc
+
+func Test_very_large_count_block_64bit()
+ throw 'Skipped: v:sizeoflong is N/A' " use legacy/put_spec.lua instead
+
+ if v:sizeoflong < 8
+ throw 'Skipped: only works with 64 bit long ints'
+ endif
+
+ new
+ call setline(1, 'x')
+ exe "norm \<C-V>y"
+ call assert_fails('norm 44444444444444p', 'E1240:')
+ bwipe!
+endfunc
+
func Test_put_above_first_line()
new
let @" = 'text'