diff options
| author | James McCoy <jamessan@jamessan.com> | 2017-04-29 21:29:44 -0400 |
|---|---|---|
| committer | James McCoy <jamessan@jamessan.com> | 2017-04-29 23:48:27 -0400 |
| commit | f219657453271f19519148d76536879bec044534 (patch) | |
| tree | e3dc982477e44401ae1dfae409896ca914a5283a /src/nvim/testdir | |
| parent | ab50c1fdb73aa58f620491d50c6fcd222d37cb9d (diff) | |
| download | rneovim-f219657453271f19519148d76536879bec044534.tar.gz rneovim-f219657453271f19519148d76536879bec044534.tar.bz2 rneovim-f219657453271f19519148d76536879bec044534.zip | |
vim-patch:7.4.2263
Problem: :filter does not work for many commands. Can only get matching
messages.
Solution: Make :filter work for :command, :map, :list, :number and :print.
Make ":filter!" show non-matching lines.
https://github.com/vim/vim/commit/d29459baa61819e59961804ed258efac5733ec70
Diffstat (limited to 'src/nvim/testdir')
| -rw-r--r-- | src/nvim/testdir/runtest.vim | 1 | ||||
| -rw-r--r-- | src/nvim/testdir/test_filter_cmd.vim | 39 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/nvim/testdir/runtest.vim b/src/nvim/testdir/runtest.vim index 1cf7ab475c..140b67a1a5 100644 --- a/src/nvim/testdir/runtest.vim +++ b/src/nvim/testdir/runtest.vim @@ -72,6 +72,7 @@ let v:testing = 1 set directory^=. set backspace= set nohidden smarttab noautoindent noautoread complete-=i noruler noshowcmd +set listchars=eol:$ " Prevent Nvim log from writing to stderr. let $NVIM_LOG_FILE='Xnvim.log' diff --git a/src/nvim/testdir/test_filter_cmd.vim b/src/nvim/testdir/test_filter_cmd.vim index f85a11ce45..0bbd905c85 100644 --- a/src/nvim/testdir/test_filter_cmd.vim +++ b/src/nvim/testdir/test_filter_cmd.vim @@ -4,6 +4,39 @@ func Test_filter() edit Xdoesnotmatch edit Xwillmatch call assert_equal('"Xwillmatch"', substitute(execute('filter willma ls'), '[^"]*\(".*"\)[^"]*', '\1', '')) + bwipe Xdoesnotmatch + bwipe Xwillmatch + + new + call setline(1, ['foo1', 'foo2', 'foo3', 'foo4', 'foo5']) + call assert_equal("\nfoo2\nfoo4", execute('filter /foo[24]/ 1,$print')) + call assert_equal("\n 2 foo2\n 4 foo4", execute('filter /foo[24]/ 1,$number')) + call assert_equal("\nfoo2$\nfoo4$", execute('filter /foo[24]/ 1,$list')) + + call assert_equal("\nfoo1$\nfoo3$\nfoo5$", execute('filter! /foo[24]/ 1,$list')) + bwipe! + + command XTryThis echo 'this' + command XTryThat echo 'that' + command XDoThat echo 'that' + let lines = split(execute('filter XTry command'), "\n") + call assert_equal(3, len(lines)) + call assert_match("XTryThat", lines[1]) + call assert_match("XTryThis", lines[2]) + delcommand XTryThis + delcommand XTryThat + delcommand XDoThat + + map f1 the first key + map f2 the second key + map f3 not a key + let lines = split(execute('filter the map f'), "\n") + call assert_equal(2, len(lines)) + call assert_match("f2", lines[0]) + call assert_match("f1", lines[1]) + unmap f1 + unmap f2 + unmap f3 endfunc func Test_filter_fails() @@ -12,4 +45,10 @@ func Test_filter_fails() call assert_fails('filter /pat', 'E476:') call assert_fails('filter /pat/', 'E476:') call assert_fails('filter /pat/ asdf', 'E492:') + + call assert_fails('filter!', 'E471:') + call assert_fails('filter! pat', 'E476:') + call assert_fails('filter! /pat', 'E476:') + call assert_fails('filter! /pat/', 'E476:') + call assert_fails('filter! /pat/ asdf', 'E492:') endfunc |