forked from mhinz/vim-grepper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some vader tests for completion feature
I want to improve file/path completion, so add some tests to cover existing behaviour (at least existing behaviour as I understand it).
- Loading branch information
Showing
2 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
Before: | ||
enew! | ||
only! | ||
cd include/completion | ||
let w:testing = 1 | ||
|
||
After: | ||
cd - | ||
|
||
Execute (command: flags, match all): | ||
Assert len(grepper#complete('-', '', v:null)) > 3 | ||
AssertEqual count(grepper#complete('-', '', v:null), '-cword '), 1 | ||
AssertEqual count(grepper#complete('-', '', v:null), '-grepprg '), 1 | ||
AssertEqual count(grepper#complete('-', '', v:null), '-tool '), 1 | ||
|
||
Execute (command: flags, match one): | ||
AssertEqual grepper#complete('-noquickf', '', v:null), ['-noquickfix '] | ||
|
||
Execute (command: flags, match some): | ||
Assert len(grepper#complete('-no', '', v:null)) > 2 | ||
AssertEqual count(grepper#complete('-no', '', v:null), '-switch '), 0 | ||
AssertEqual count(grepper#complete('-no', '', v:null), '-noswitch '), 1 | ||
|
||
Execute (command: flags, -dir options): | ||
Assert len(grepper#complete('', 'Grepper -dir ', v:null)) > 2 | ||
AssertEqual count(grepper#complete('', 'Grepper -dir ', v:null), 'cwd '), 1 | ||
AssertEqual count(grepper#complete('', 'Grepper -dir ', v:null), 'repo '), 1 | ||
|
||
Execute (command: flags, -stop completion): | ||
Assert grepper#complete('', 'Grepper -stop ', v:null)[0] =~# '\d\+' | ||
|
||
Execute (command: flags, -tool options): | ||
Assert len(grepper#complete('', 'Grepper -tool ', v:null)) > 1 | ||
AssertEqual count(grepper#complete('', 'Grepper -tool ', v:null), 'grep '), 1 | ||
|
||
Execute (command: flags, -tool options): | ||
Assert len(grepper#complete('', 'Grepper -tool ', v:null)) > 1 | ||
AssertEqual count(grepper#complete('', 'Grepper -tool ', v:null), 'grep '), 1 | ||
|
||
Execute (prompt: relative path, empty string): | ||
AssertEqual grepper#complete_files('x ', v:null, v:null), ['x ./foo/'] | ||
|
||
Execute (prompt: relative path, whitespace only): | ||
AssertEqual grepper#complete_files('x ', v:null, v:null), ['x ./foo/'] | ||
|
||
Execute (prompt: sub-path, ./ exact match): | ||
AssertEqual grepper#complete_files('x ./', v:null, v:null), ['x ./foo/'] | ||
|
||
Execute (prompt: sub-path, ./ and word chars): | ||
AssertEqual grepper#complete_files('x ./f', v:null, v:null), ['x ./foo/'] | ||
|
||
Execute (prompt: nested sub-path, e.g. ./foo/): | ||
AssertEqual grepper#complete_files('x ./foo/', v:null, v:null), ['x ./foo/bar/'] | ||
|
||
Execute (prompt: absolute path, / exact match): | ||
AssertEqual count(grepper#complete_files('x /', v:null, v:null), 'x /bin/'), 1 | ||
AssertEqual count(grepper#complete_files('x /', v:null, v:null), 'x /var/'), 1 | ||
|
||
Execute (prompt: absolute path, / and word chars): | ||
AssertEqual count(grepper#complete_files('x /b', v:null, v:null), 'x /bin/'), 1 | ||
AssertEqual count(grepper#complete_files('x /b', v:null, v:null), 'x /var/'), 0 |
Empty file.