0
0
mirror of https://github.com/vim/vim.git synced 2025-10-09 06:14:17 -04:00

patch 8.1.1835: cannot use printf() as a method

Problem:    Cannot use printf() as a method.
Solution:   Pass the base as the second argument to printf().
This commit is contained in:
Bram Moolenaar
2019-08-10 00:13:30 +02:00
parent 22a0c0c4ec
commit fd8ca21b3f
4 changed files with 17 additions and 9 deletions

View File

@@ -67,13 +67,15 @@ func Test_dict_method()
endfunc
func Test_string_method()
call assert_equal(['1', '2', '3'], '1 2 3'->split())
call assert_equal([1, 2, 3], '1 2 3'->split()->map({i, v -> str2nr(v)}))
call assert_equal([65, 66, 67], 'ABC'->str2list())
call assert_equal(3, 'ABC'->strlen())
call assert_equal('a^Mb^[c', "a\rb\ec"->strtrans())
call assert_equal(4, "aあb"->strwidth())
call assert_equal('axc', 'abc'->substitute('b', 'x', ''))
eval '1 2 3'->split()->assert_equal(['1', '2', '3'])
eval '1 2 3'->split()->map({i, v -> str2nr(v)})->assert_equal([1, 2, 3])
eval 'ABC'->str2list()->assert_equal([65, 66, 67])
eval 'ABC'->strlen()->assert_equal(3)
eval "a\rb\ec"->strtrans()->assert_equal('a^Mb^[c')
eval "aあb"->strwidth()->assert_equal(4)
eval 'abc'->substitute('b', 'x', '')->assert_equal('axc')
eval 'abc'->printf('the %s arg')->assert_equal('the abc arg')
endfunc
func Test_method_append()