Bram Moolenaar | bf55e14 | 2010-11-16 11:32:01 +0100 | [diff] [blame] | 1 | Tests for completefunc/omnifunc. vim: set ft=vim : |
| 2 | |
| 3 | STARTTEST |
| 4 | :"Test that nothing happens if the 'completefunc' opens |
| 5 | :"a new window (no completion, no crash) |
| 6 | :so small.vim |
| 7 | :function! DummyCompleteOne(findstart, base) |
| 8 | : if a:findstart |
| 9 | : return 0 |
| 10 | : else |
| 11 | : wincmd n |
| 12 | : return ['onedef', 'oneDEF'] |
| 13 | : endif |
| 14 | :endfunction |
| 15 | :setlocal completefunc=DummyCompleteOne |
| 16 | /^one |
| 17 | A:q! |
| 18 | :function! DummyCompleteTwo(findstart, base) |
| 19 | : if a:findstart |
| 20 | : wincmd n |
| 21 | : return 0 |
| 22 | : else |
| 23 | : return ['twodef', 'twoDEF'] |
| 24 | : endif |
| 25 | :endfunction |
| 26 | :setlocal completefunc=DummyCompleteTwo |
| 27 | /^two |
| 28 | A:q! |
| 29 | :"Test that 'completefunc' works when it's OK. |
| 30 | :function! DummyCompleteThree(findstart, base) |
| 31 | : if a:findstart |
| 32 | : return 0 |
| 33 | : else |
| 34 | : return ['threedef', 'threeDEF'] |
| 35 | : endif |
| 36 | :endfunction |
| 37 | :setlocal completefunc=DummyCompleteThree |
| 38 | /^three |
| 39 | A:/^+++/,/^three/w! test.out |
| 40 | :qa! |
| 41 | ENDTEST |
| 42 | |
| 43 | +++ |
| 44 | one |
| 45 | two |
| 46 | three |