summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_expr.vim
diff options
context:
space:
mode:
authorpresuku <presuku@users.noreply.github.com>2021-11-20 19:38:31 +0000
committerBram Moolenaar <Bram@vim.org>2021-11-20 19:38:31 +0000
commitd85fccdfed58108c4e0958d0b17c64690b5f073f (patch)
tree1b0d2973f2c49e6f8bb0925c57740c193fb7cf4b /src/testdir/test_expr.vim
parenta1198124370a366ff02811a43845a631b5c6e7f0 (diff)
patch 8.2.3630: printf() with %S does not handle multi-byte correctlyv8.2.3630
Problem: Printf() with %S does not handle multi-byte correctly. Solution: Count cells instead of bytes. (closes #9169, closes #7486)
Diffstat (limited to 'src/testdir/test_expr.vim')
-rw-r--r--src/testdir/test_expr.vim5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim
index 080eee7e10..9700974278 100644
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -297,6 +297,11 @@ function Test_printf_misc()
call assert_equal('🐍', printf('%.2S', '🐍🐍'))
call assert_equal('', printf('%.1S', '🐍🐍'))
+ call assert_equal('[ あいう]', printf('[%10.6S]', 'あいうえお'))
+ call assert_equal('[ あいうえ]', printf('[%10.8S]', 'あいうえお'))
+ call assert_equal('[あいうえお]', printf('[%10.10S]', 'あいうえお'))
+ call assert_equal('[あいうえお]', printf('[%10.12S]', 'あいうえお'))
+
call assert_equal('1%', printf('%d%%', 1))
endfunc