summaryrefslogtreecommitdiff
path: root/src/testdir
diff options
context:
space:
mode:
authorshadmansaleh <shadmansaleh3@gmail.com>2021-05-15 17:23:28 +0200
committerBram Moolenaar <Bram@vim.org>2021-05-15 17:23:28 +0200
commit30e3de21fc36153c5f7c9cf9db90bcc60dd67fb9 (patch)
tree009edc4fee70a74a78f74d680a58e0dd1b9ca5b3 /src/testdir
parentd832c3c56ec7043322ad3e99897e312700fa1d3e (diff)
downloadvim-git-30e3de21fc36153c5f7c9cf9db90bcc60dd67fb9.tar.gz
patch 8.2.2854: custom statusline cannot contain % itemsv8.2.2854
Problem: Custom statusline cannot contain % items. Solution: Add "%{% expr %}". (closes #8190)
Diffstat (limited to 'src/testdir')
-rw-r--r--src/testdir/test_statusline.vim20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/testdir/test_statusline.vim b/src/testdir/test_statusline.vim
index ca28379f5..f3eea2e71 100644
--- a/src/testdir/test_statusline.vim
+++ b/src/testdir/test_statusline.vim
@@ -251,6 +251,26 @@ func Test_statusline()
call assert_match('^vimLineComment\s*$', s:get_statusline())
syntax off
+ "%{%expr%}: evaluates enxpressions present in result of expr
+ func! Inner_eval()
+ return '%n some other text'
+ endfunc
+ func! Outer_eval()
+ return 'some text %{%Inner_eval()%}'
+ endfunc
+ set statusline=%{%Outer_eval()%}
+ call assert_match('^some text ' . bufnr() . ' some other text\s*$', s:get_statusline())
+ delfunc Inner_eval
+ delfunc Outer_eval
+
+ "%{%expr%}: Doesn't get stuck in recursion
+ func! Recurse_eval()
+ return '%{%Recurse_eval()%}'
+ endfunc
+ set statusline=%{%Recurse_eval()%}
+ call assert_match('^%{%Recurse_eval()%}\s*$', s:get_statusline())
+ delfunc Recurse_eval
+
"%(: Start of item group.
set statusline=ab%(cd%q%)de
call assert_match('^abde\s*$', s:get_statusline())