-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jon Cairns
committed
May 4, 2012
1 parent
8fec6e3
commit 3b15930
Showing
2 changed files
with
48 additions
and
3 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,28 @@ | ||
import os | ||
import sys | ||
import vim | ||
import re | ||
|
||
def parse_test_output( ): | ||
fd = open("/tmp/caketest_output") | ||
found = False | ||
parsing = False | ||
k = 0 | ||
firsterr = -1 | ||
numfails = 0 | ||
for line in fd: | ||
if k == firsterr: | ||
parsing = True | ||
if parsing: | ||
print line | ||
if found == True: | ||
p = re.compile('There (?:were|was) ([0-9]*) failure',line) | ||
m = p.match(line) | ||
numfails = m.group(1) | ||
firsterr = k+2 | ||
break | ||
if "Time: " in line: | ||
found = True | ||
k = k + 1 | ||
|
||
|
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 |
---|---|---|
@@ -1,6 +1,23 @@ | ||
if filereadable($VIMRUNTIME."/plugin/cakephp.py") | ||
pyfile $VIMRUNTIME/plugin/cakephp.py | ||
elseif filereadable($HOME."/.vim/plugin/cakephp.py") | ||
pyfile $HOME/.vim/plugin/cakephp.py | ||
else | ||
" when we use pathogen for instance | ||
let $CUR_DIRECTORY=expand("<sfile>:p:h") | ||
|
||
function! cakephp#RunTests(arg) | ||
exe "caketest --no-colors ".a:arg | ||
if filereadable($CUR_DIRECTORY."/cakephp.py") | ||
pyfile $CUR_DIRECTORY/cakephp.py | ||
else | ||
call confirm('cakephp.vim: Unable to find cakephp.py. Place it in either your home vim directory or in the Vim runtime directory.', 'OK') | ||
finish | ||
endif | ||
endif | ||
|
||
command! -nargs=1 Test call s:RunCakePHPTests(<q-args>) | ||
|
||
function! s:RunCakePHPTests(arg) | ||
exe "!caketest --no-colors ".a:arg." | tee /tmp/caketest_output" | ||
python parse_test_output() | ||
endfunction | ||
|
||
command! -nargs=1 Test call cakephp#RunTests(<args>) |