Permalink
Browse files

move code for test to test file.

  • Loading branch information...
tyru committed Dec 8, 2010
1 parent 6b970e1 commit 053928b25a0cd74bd086fcb94978c40cfb676151
Showing with 23 additions and 35 deletions.
  1. +0 −31 autoload/simpletap/test.vim
  2. +23 −4 test/01-oo-way-and-function-way-should-be-the-same.vim
@@ -46,37 +46,6 @@ endfunction "}}}
-" for the test of simpletap itself.
-
-function! simpletap#test#locked_call(...) "{{{
- return call('s:locked_call', a:000)
-endfunction "}}}
-
-function! simpletap#test#locked_call_silent(...) "{{{
- silent return call('s:locked_call', a:000)
-endfunction "}}}
-
-function! s:locked_call(Fn, args, ...) "{{{
- if a:0 == 0
- call simpletap#_stat_lock()
- try
- return call(a:Fn, a:args)
- finally
- call simpletap#_stat_unlock()
- endtry
- else
- let obj = a:1
- call obj._stat.lock()
- try
- return call(a:Fn, a:args, obj)
- finally
- call obj._stat.unlock()
- endtry
- endif
-endfunction "}}}
-
-
-
" Restore 'cpoptions' {{{
let &cpo = s:save_cpo
" }}}
@@ -7,6 +7,25 @@ set cpo&vim
" }}}
+function! s:locked_call(Fn, args, ...) "{{{
+ if a:0 == 0
+ call simpletap#_stat_lock()
+ try
+ return call(a:Fn, a:args)
+ finally
+ call simpletap#_stat_unlock()
+ endtry
+ else
+ let obj = a:1
+ call obj._stat.lock()
+ try
+ return call(a:Fn, a:args, obj)
+ finally
+ call obj._stat.unlock()
+ endtry
+ endif
+endfunction "}}}
+
function! s:run() "{{{
let o = simpletap#new()
@@ -52,16 +71,16 @@ function! s:run() "{{{
\ || method ==# 'stdout_isnt'
\ || method ==# 'stdout_like'
\ || method ==# 'stdout_unlike'
- let got = simpletap#util#locked_call_silent(o[method], args, o)
- let expected = simpletap#util#locked_call_silent('simpletap#' . method, args)
+ silent let got = s:locked_call(o[method], args, o)
+ silent let expected = s:locked_call('simpletap#' . method, args)
Is got, expected, method
else
redir => got_output
- let got = simpletap#util#locked_call_silent(o[method], args, o)
+ silent let got = s:locked_call(o[method], args, o)
redir END
redir => expected_output
- let expected = simpletap#util#locked_call_silent('simpletap#' . method, args)
+ silent let expected = s:locked_call('simpletap#' . method, args)
redir END
Is got, expected, method

0 comments on commit 053928b

Please sign in to comment.