summaryrefslogtreecommitdiff
path: root/src/testdir/test_functions.vim
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-07 19:05:09 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-07 19:05:09 +0200
commitf6ed61e1489e40eada55a4f1782e1ed82bcad7d9 (patch)
tree59c67f3a73489d4536e741b883a9ad5f45c3cc2f /src/testdir/test_functions.vim
parent30e9b3c4256710781c3bd64efb33f138e4e074b3 (diff)
downloadvim-git-f6ed61e1489e40eada55a4f1782e1ed82bcad7d9.tar.gz
patch 8.1.2004: more functions can be used as methodsv8.1.2004
Problem: More functions can be used as methods. Solution: Make various functions usable as a method.
Diffstat (limited to 'src/testdir/test_functions.vim')
-rw-r--r--src/testdir/test_functions.vim12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 3588c767a..4c6d2a89f 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -138,7 +138,7 @@ func Test_str2nr()
call assert_equal(-123456789, str2nr('-123456789'))
call assert_equal(5, str2nr('101', 2))
- call assert_equal(5, str2nr('0b101', 2))
+ call assert_equal(5, '0b101'->str2nr(2))
call assert_equal(5, str2nr('0B101', 2))
call assert_equal(-5, str2nr('-101', 2))
call assert_equal(-5, str2nr('-0b101', 2))
@@ -184,7 +184,7 @@ func Test_strftime()
" of strftime() can be 17 or 18, depending on timezone.
call assert_match('^2017-01-1[78]$', strftime('%Y-%m-%d', 1484695512))
"
- call assert_match('^\d\d\d\d-\(0\d\|1[012]\)-\([012]\d\|3[01]\) \([01]\d\|2[0-3]\):[0-5]\d:\([0-5]\d\|60\)$', strftime('%Y-%m-%d %H:%M:%S'))
+ call assert_match('^\d\d\d\d-\(0\d\|1[012]\)-\([012]\d\|3[01]\) \([01]\d\|2[0-3]\):[0-5]\d:\([0-5]\d\|60\)$', '%Y-%m-%d %H:%M:%S'->strftime())
call assert_fails('call strftime([])', 'E730:')
call assert_fails('call strftime("%Y", [])', 'E745:')
@@ -415,7 +415,7 @@ endfunc
func Test_strpart()
call assert_equal('de', strpart('abcdefg', 3, 2))
call assert_equal('ab', strpart('abcdefg', -2, 4))
- call assert_equal('abcdefg', strpart('abcdefg', -2))
+ call assert_equal('abcdefg', 'abcdefg'->strpart(-2))
call assert_equal('fg', strpart('abcdefg', 5, 4))
call assert_equal('defg', strpart('abcdefg', 3))
@@ -763,11 +763,11 @@ endfunc
func Test_stridx()
call assert_equal(-1, stridx('', 'l'))
call assert_equal(0, stridx('', ''))
- call assert_equal(0, stridx('hello', ''))
+ call assert_equal(0, 'hello'->stridx(''))
call assert_equal(-1, stridx('hello', 'L'))
call assert_equal(2, stridx('hello', 'l', -1))
call assert_equal(2, stridx('hello', 'l', 0))
- call assert_equal(2, stridx('hello', 'l', 1))
+ call assert_equal(2, 'hello'->stridx('l', 1))
call assert_equal(3, stridx('hello', 'l', 3))
call assert_equal(-1, stridx('hello', 'l', 4))
call assert_equal(-1, stridx('hello', 'l', 10))
@@ -780,7 +780,7 @@ func Test_strridx()
call assert_equal(0, strridx('', ''))
call assert_equal(5, strridx('hello', ''))
call assert_equal(-1, strridx('hello', 'L'))
- call assert_equal(3, strridx('hello', 'l'))
+ call assert_equal(3, 'hello'->strridx('l'))
call assert_equal(3, strridx('hello', 'l', 10))
call assert_equal(3, strridx('hello', 'l', 3))
call assert_equal(2, strridx('hello', 'l', 2))