mirror of
https://github.com/neovim/neovim.git
synced 2025-10-14 13:56:05 +00:00
vim-patch:8.0.0167
Problem: str2nr() and str2float() do not always work with negative values.
Solution: Be more flexible about handling signs. (LemonBoy, closes vim/vim#1332)
Add more tests.
08243d26d2
This commit is contained in:
@@ -1,3 +1,22 @@
|
||||
" Tests for various functions.
|
||||
|
||||
func Test_str2nr()
|
||||
call assert_equal(0, str2nr(''))
|
||||
call assert_equal(1, str2nr('1'))
|
||||
call assert_equal(1, str2nr(' 1 '))
|
||||
|
||||
call assert_equal(1, str2nr('+1'))
|
||||
call assert_equal(1, str2nr('+ 1'))
|
||||
call assert_equal(1, str2nr(' + 1 '))
|
||||
|
||||
call assert_equal(-1, str2nr('-1'))
|
||||
call assert_equal(-1, str2nr('- 1'))
|
||||
call assert_equal(-1, str2nr(' - 1 '))
|
||||
|
||||
call assert_equal(123456789, str2nr('123456789'))
|
||||
call assert_equal(-123456789, str2nr('-123456789'))
|
||||
endfunc
|
||||
|
||||
func Test_setbufvar_options()
|
||||
" This tests that aucmd_prepbuf() and aucmd_restbuf() properly restore the
|
||||
" window layout.
|
||||
|
Reference in New Issue
Block a user