aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Hahler <github@thequod.de>2018-09-23 17:15:17 +0200
committerJustin M. Keyes <justinkz@gmail.com>2018-09-23 17:15:17 +0200
commitd3c90cbbb420dd9ea7fc0e1523e9c89a0f8476d0 (patch)
tree5d14c77b83bd175fc728745eee1536e8af76ddfa
parent9183e2c67e82b55c6dba19266671d07a6604c0f1 (diff)
downloadrneovim-d3c90cbbb420dd9ea7fc0e1523e9c89a0f8476d0.tar.gz
rneovim-d3c90cbbb420dd9ea7fc0e1523e9c89a0f8476d0.tar.bz2
rneovim-d3c90cbbb420dd9ea7fc0e1523e9c89a0f8476d0.zip
vim-patch:8.0.1557: printf() does not work with only one argument (#9038)
Problem: printf() does not work with only one argument. (Daniel Hahler) Solution: Allow using just the format. (Ken Takata, closes vim/vim#2687) https://github.com/vim/vim/commit/c71807db9c1821baf86796cd76952df36ff1a29a
-rw-r--r--src/nvim/eval.lua2
-rw-r--r--src/nvim/testdir/test_expr.vim3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/nvim/eval.lua b/src/nvim/eval.lua
index 328f46443f..e72bb7b870 100644
--- a/src/nvim/eval.lua
+++ b/src/nvim/eval.lua
@@ -222,7 +222,7 @@ return {
pathshorten={args=1},
pow={args=2},
prevnonblank={args=1},
- printf={args=varargs(2)},
+ printf={args=varargs(1)},
pumvisible={},
py3eval={args=1},
pyeval={args=1},
diff --git a/src/nvim/testdir/test_expr.vim b/src/nvim/testdir/test_expr.vim
index ad967c528c..aaf32dff04 100644
--- a/src/nvim/testdir/test_expr.vim
+++ b/src/nvim/testdir/test_expr.vim
@@ -166,6 +166,9 @@ function Test_printf_spec_s()
endfunc
function Test_printf_misc()
+ call assert_equal('123', printf('123'))
+ call assert_fails("call printf('123', 3)", "E767:")
+
call assert_equal('123', printf('%d', 123))
call assert_equal('123', printf('%i', 123))
call assert_equal('123', printf('%D', 123))