diff src/testdir/test_functions.vim @ 18017:988e5a868b60 v8.1.2004

patch 8.1.2004: more functions can be used as methods Commit: https://github.com/vim/vim/commit/f6ed61e1489e40eada55a4f1782e1ed82bcad7d9 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Sep 7 19:05:09 2019 +0200 patch 8.1.2004: more functions can be used as methods Problem: More functions can be used as methods. Solution: Make various functions usable as a method.
author Bram Moolenaar <Bram@vim.org>
date Sat, 07 Sep 2019 19:15:04 +0200
parents 7a19c8d6bb9e
children 11dca9732a48
line wrap: on
line diff
--- 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))