Mercurial > vim
comparison src/testdir/test_filter_cmd.vim @ 14968:c5ec5ddbe814 v8.1.0495
patch 8.1.0495: :filter only supports some commands
commit https://github.com/vim/vim/commit/f86db78fed78541cefdb706e4779ce5ae9ca7820
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Oct 25 13:31:37 2018 +0200
patch 8.1.0495: :filter only supports some commands
Problem: :filter only supports some commands.
Solution: Add :filter support for more commands. (Marcin Szamotulski,
closes #2856)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 25 Oct 2018 13:45:05 +0200 |
parents | d4777be849d0 |
children | 5b06b642fbee |
comparison
equal
deleted
inserted
replaced
14967:5acaac1226fd | 14968:c5ec5ddbe814 |
---|---|
85 let out = trim(out, '" ') | 85 let out = trim(out, '" ') |
86 endif | 86 endif |
87 call assert_equal('a|b', out) | 87 call assert_equal('a|b', out) |
88 set shelltemp& | 88 set shelltemp& |
89 endfunction | 89 endfunction |
90 | |
91 func Test_filter_commands() | |
92 let g:test_filter_a = 1 | |
93 let b:test_filter_b = 2 | |
94 let test_filter_c = 3 | |
95 | |
96 " Test filtering :let command | |
97 let res = split(execute("filter /^test_filter/ let"), "\n") | |
98 call assert_equal(["test_filter_a #1"], res) | |
99 | |
100 let res = split(execute("filter /\\v^(b:)?test_filter/ let"), "\n") | |
101 call assert_equal(["test_filter_a #1", "b:test_filter_b #2"], res) | |
102 | |
103 unlet g:test_filter_a | |
104 unlet b:test_filter_b | |
105 unlet test_filter_c | |
106 | |
107 " Test filtering :set command | |
108 let res = join(split(execute("filter /^help/ set"), "\n")[1:], " ") | |
109 call assert_match('^\s*helplang=\w*$', res) | |
110 | |
111 " Test filtering :llist command | |
112 call setloclist(0, [{"filename": "/path/vim.c"}, {"filename": "/path/vim.h"}, {"module": "Main.Test"}]) | |
113 let res = split(execute("filter /\\.c$/ llist"), "\n") | |
114 call assert_equal([" 1 /path/vim.c: "], res) | |
115 | |
116 let res = split(execute("filter /\\.Test$/ llist"), "\n") | |
117 call assert_equal([" 3 Main.Test: "], res) | |
118 | |
119 " Test filtering :jump command | |
120 e file.c | |
121 e file.h | |
122 e file.hs | |
123 let res = split(execute("filter /\.c$/ jumps"), "\n")[1:] | |
124 call assert_equal([" 2 1 0 file.c", ">"], res) | |
125 | |
126 bwipe file.c | |
127 bwipe file.h | |
128 bwipe file.hs | |
129 endfunc |