Skip to content
This repository has been archived by the owner on Jun 24, 2018. It is now read-only.

Commit

Permalink
Merge branch 'master' of https://github.com/ayarulin/vim-extest into …
Browse files Browse the repository at this point in the history
…ayarulin-master

Conflicts:
	Readme.md
  • Loading branch information
BjRo committed Mar 16, 2016
2 parents ad98eee + eb90104 commit 79b547e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ By default extest.vim doesn't bind to any keys but is available in the form of c
* `:ExTestRunFile` runs all the tests in the file that is loaded into the current buffer
* `:ExTestRunTest` runs the test case under the cursor
* `:ExTestRunLast` runs the last test, from any buffer
* `:ExTestRunCurrentOrLast` runs test case under the cursor or the last test (from any buffer)

If you want to bind those commands to your leader keys, you can do so nevertheless. For example:

```vim
map <leader>T :ExTestRunFile<CR>
map <leader>t :ExTestRunCurrentOrLast<CR>
```
or:
```vim
map <leader>T :ExTestRunFile<CR>
map <leader>t :ExTestRunTest<CR>
Expand Down
12 changes: 12 additions & 0 deletions plugin/extest.vim
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ endif
command ExTestRunFile call <SID>RunFile()
command ExTestRunTest call <SID>RunTest()
command ExTestRunLast call <SID>RunLast()
command ExTestRunCurrentOrLast call <SID>RunCurrentOrLast()

function s:RunFile()
return s:ExecTestRun("file")
Expand All @@ -59,6 +60,17 @@ function s:RunLast()
return s:RunCommand(g:extest_last_cmd)
endfunction

function s:RunCurrentOrLast()
let l:framework = s:IdentifyFramework()

if empty(l:framework)
return s:RunLast()
else
return s:RunTest()
endif
endfunction


" Starts a test run.
" @param type ["test" | "file"]
function s:ExecTestRun(type)
Expand Down

0 comments on commit 79b547e

Please sign in to comment.