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:
James McCoy
2017-06-05 22:39:09 -04:00
parent b1d4ef2b42
commit 17d616037d
4 changed files with 45 additions and 3 deletions

View File

@@ -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.