aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/matchparen_spec.lua44
-rw-r--r--test/old/testdir/test_plugin_matchparen.vim32
2 files changed, 76 insertions, 0 deletions
diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua
index d992420c30..367830b564 100644
--- a/test/functional/legacy/matchparen_spec.lua
+++ b/test/functional/legacy/matchparen_spec.lua
@@ -195,4 +195,48 @@ describe('matchparen', function()
{5:-- INSERT --} |
]])
end)
+
+ -- oldtest: Test_matchparen_ignore_sh_case()
+ it('ignores shell case statements', function()
+ local screen = Screen.new(40, 15)
+ exec([[
+ syntax on
+ source $VIMRUNTIME/plugin/matchparen.vim
+ set ft=sh
+ call setline(1, [
+ \ '#!/bin/sh',
+ \ 'SUSUWU_PRINT() (',
+ \ ' case "${LEVEL}" in',
+ \ ' "$SUSUWU_SH_NOTICE")',
+ \ ' ${SUSUWU_S} && return 1',
+ \ ' ;;',
+ \ ' "$SUSUWU_SH_DEBUG")',
+ \ ' (! ${SUSUWU_VERBOSE}) && return 1',
+ \ ' ;;',
+ \ ' esac',
+ \ ' # snip',
+ \ ')'
+ \ ])
+ call cursor(4, 26)
+ ]])
+ screen:add_extra_attr_ids({
+ [100] = { foreground = tonumber('0x6a0dad') },
+ })
+ screen:expect([[
+ {18:#!/bin/sh} |
+ {25:SUSUWU_PRINT() (} |
+ {15:case} {15:"}{100:${LEVEL}}{15:"} {15:in} |
+ {15:"}{100:$SUSUWU_SH_NOTICE}{15:"^)} |
+ {100:${SUSUWU_S}} {15:&&} {15:return} {26:1} |
+ {15:;;} |
+ {15:"}{100:$SUSUWU_SH_DEBUG}{15:")} |
+ {100:(}{15:!} {100:${SUSUWU_VERBOSE})} {15:&&} {15:return} {26:1} |
+ {15:;;} |
+ {15:esac} |
+ {18:# snip} |
+ {25:)} |
+ {1:~ }|*2
+ |
+ ]])
+ end)
end)
diff --git a/test/old/testdir/test_plugin_matchparen.vim b/test/old/testdir/test_plugin_matchparen.vim
index 7d80e43046..0739906a42 100644
--- a/test/old/testdir/test_plugin_matchparen.vim
+++ b/test/old/testdir/test_plugin_matchparen.vim
@@ -139,4 +139,36 @@ func Test_matchparen_mbyte()
call StopVimInTerminal(buf)
endfunc
+" Test for ignoring certain parenthesis
+func Test_matchparen_ignore_sh_case()
+ CheckScreendump
+
+ let lines =<< trim END
+ source $VIMRUNTIME/plugin/matchparen.vim
+ set ft=sh
+ call setline(1, [
+ \ '#!/bin/sh',
+ \ 'SUSUWU_PRINT() (',
+ \ ' case "${LEVEL}" in',
+ \ ' "$SUSUWU_SH_NOTICE")',
+ \ ' ${SUSUWU_S} && return 1',
+ \ ' ;;',
+ \ ' "$SUSUWU_SH_DEBUG")',
+ \ ' (! ${SUSUWU_VERBOSE}) && return 1',
+ \ ' ;;',
+ \ ' esac',
+ \ ' # snip',
+ \ ')'
+ \ ])
+ call cursor(4, 26)
+ END
+
+ let filename = 'Xmatchparen_sh'
+ call writefile(lines, filename, 'D')
+
+ let buf = RunVimInTerminal('-S '.filename, #{rows: 10})
+ call VerifyScreenDump(buf, 'Test_matchparen_sh_case_1', {})
+ call StopVimInTerminal(buf)
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab