summaryrefslogtreecommitdiff
path: root/src/testdir/test_functions.vim
blob: ec816d1414d3dcbc0b805c5877c1f53bdf5bd005 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
" 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