diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2019-07-29 00:34:47 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-29 00:34:47 +0200 |
| commit | 4213492231cc9b3ae900657d8ab88039f2f4eb91 (patch) | |
| tree | 05fc2e328a39d522146b09095289d3021d9b0314 /src/nvim/testdir/test_vimscript.vim | |
| parent | 00d915d02159037634f0f9628400648cc14da871 (diff) | |
| parent | b457a58e34d43d49a01dd93ec356099d232bd713 (diff) | |
| download | rneovim-4213492231cc9b3ae900657d8ab88039f2f4eb91.tar.gz rneovim-4213492231cc9b3ae900657d8ab88039f2f4eb91.tar.bz2 rneovim-4213492231cc9b3ae900657d8ab88039f2f4eb91.zip | |
Merge #10643 from janlazo/vim-8.1.1765
vim-patch:8.1.{990,992,1765}
Diffstat (limited to 'src/nvim/testdir/test_vimscript.vim')
| -rw-r--r-- | src/nvim/testdir/test_vimscript.vim | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/nvim/testdir/test_vimscript.vim b/src/nvim/testdir/test_vimscript.vim index f3e40e1210..f39e53d6dd 100644 --- a/src/nvim/testdir/test_vimscript.vim +++ b/src/nvim/testdir/test_vimscript.vim @@ -21,7 +21,7 @@ com! -nargs=1 Xout call Xout(<args>) " " Create a script that consists of the body of the function a:funcname. " Replace any ":return" by a ":finish", any argument variable by a global -" variable, and and every ":call" by a ":source" for the next following argument +" variable, and every ":call" by a ":source" for the next following argument " in the variable argument list. This function is useful if similar tests are " to be made for a ":return" from a function call or a ":finish" in a script " file. @@ -1310,6 +1310,43 @@ func Test_compound_assignment_operators() let x .= 'n' call assert_equal('2n', x) + " Test special cases: division or modulus with 0. + let x = 1 + let x /= 0 + if has('num64') + call assert_equal(0x7FFFFFFFFFFFFFFF, x) + else + call assert_equal(0x7fffffff, x) + endif + + let x = -1 + let x /= 0 + if has('num64') + call assert_equal(-0x7FFFFFFFFFFFFFFF, x) + else + call assert_equal(-0x7fffffff, x) + endif + + let x = 0 + let x /= 0 + if has('num64') + call assert_equal(-0x7FFFFFFFFFFFFFFF - 1, x) + else + call assert_equal(-0x7FFFFFFF - 1, x) + endif + + let x = 1 + let x %= 0 + call assert_equal(0, x) + + let x = -1 + let x %= 0 + call assert_equal(0, x) + + let x = 0 + let x %= 0 + call assert_equal(0, x) + " Test for string let x = 'str' let x .= 'ing' |