let s:python = PythonProg()
if s:python == ''
- " Can't run this test.
+ " Can't run this test without Python.
finish
endif
+" Uncomment the next line to see what happens. Output is in
+" src/testdir/channellog.
+" call ch_logfile('channellog', 'w')
+
let s:chopt = {}
" Run "testfunc" after sarting the server and stop the server afterwards.
let handle = ch_open('localhost:' . a:port, s:chopt)
unlet s:chopt.drop
if ch_status(handle) == "fail"
- call assert_false(1, "Can't open channel")
+ call assert_report("Can't open channel")
return
endif
if has('job')
call ch_sendexpr(handle, 'hello!', {'callback': 'Ch_requestHandler'})
call WaitFor('exists("g:Ch_responseHandle")')
if !exists('g:Ch_responseHandle')
- call assert_false(1, 'g:Ch_responseHandle was not set')
+ call assert_report('g:Ch_responseHandle was not set')
else
call assert_equal(handle, g:Ch_responseHandle)
unlet g:Ch_responseHandle
call ch_sendexpr(handle, 'hello!', {'callback': function('Ch_requestHandler')})
call WaitFor('exists("g:Ch_responseHandle")')
if !exists('g:Ch_responseHandle')
- call assert_false(1, 'g:Ch_responseHandle was not set')
+ call assert_report('g:Ch_responseHandle was not set')
else
call assert_equal(handle, g:Ch_responseHandle)
unlet g:Ch_responseHandle
call ch_sendexpr(handle, 'hello!', {'callback': {a, b -> Ch_requestHandler(a, b)}})
call WaitFor('exists("g:Ch_responseHandle")')
if !exists('g:Ch_responseHandle')
- call assert_false(1, 'g:Ch_responseHandle was not set')
+ call assert_report('g:Ch_responseHandle was not set')
else
call assert_equal(handle, g:Ch_responseHandle)
unlet g:Ch_responseHandle
let handle = ch_open('localhost:' . a:port, s:chopt)
call assert_equal(v:t_channel, type(handle))
if ch_status(handle) == "fail"
- call assert_false(1, "Can't open channel")
+ call assert_report("Can't open channel")
return
endif
let newhandle = ch_open('localhost:' . a:port, s:chopt)
if ch_status(newhandle) == "fail"
- call assert_false(1, "Can't open second channel")
+ call assert_report("Can't open second channel")
return
endif
call assert_equal('got it', ch_evalexpr(newhandle, 'hello!'))
func Ch_server_crash(port)
let handle = ch_open('localhost:' . a:port, s:chopt)
if ch_status(handle) == "fail"
- call assert_false(1, "Can't open channel")
+ call assert_report("Can't open channel")
return
endif
func Ch_channel_handler(port)
let handle = ch_open('localhost:' . a:port, s:chopt)
if ch_status(handle) == "fail"
- call assert_false(1, "Can't open channel")
+ call assert_report("Can't open channel")
return
endif
func Ch_channel_zero(port)
let handle = ch_open('localhost:' . a:port, s:chopt)
if ch_status(handle) == "fail"
- call assert_false(1, "Can't open channel")
+ call assert_report("Can't open channel")
return
endif
func Ch_raw_one_time_callback(port)
let handle = ch_open('localhost:' . a:port, s:chopt)
if ch_status(handle) == "fail"
- call assert_false(1, "Can't open channel")
+ call assert_report("Can't open channel")
return
endif
call ch_setoptions(handle, {'mode': 'raw'})
endif
catch
if v:exception !~ 'Connection reset by peer'
- call assert_false(1, "Caught exception: " . v:exception)
+ call assert_report("Caught exception: " . v:exception)
endif
endtry
endfunc
let channel = ch_open('localhost:' . a:port, s:chopt)
unlet s:chopt.waittime
if ch_status(channel) == "fail"
- call assert_false(1, "Can't open channel")
+ call assert_report("Can't open channel")
return
endif
call assert_equal('got it', ch_evalexpr(channel, 'hello!'))
function Ch_test_call(port)
let handle = ch_open('localhost:' . a:port, s:chopt)
if ch_status(handle) == "fail"
- call assert_false(1, "Can't open channel")
+ call assert_report("Can't open channel")
return
endif
function Ch_test_close_callback(port)
let handle = ch_open('localhost:' . a:port, s:chopt)
if ch_status(handle) == "fail"
- call assert_false(1, "Can't open channel")
+ call assert_report("Can't open channel")
return
endif
call ch_setoptions(handle, {'close_cb': 'MyCloseCb'})
function Ch_test_close_partial(port)
let handle = ch_open('localhost:' . a:port, s:chopt)
if ch_status(handle) == "fail"
- call assert_false(1, "Can't open channel")
+ call assert_report("Can't open channel")
return
endif
let g:Ch_d = {}
function Ch_test_close_lambda(port)
let handle = ch_open('localhost:' . a:port, s:chopt)
if ch_status(handle) == "fail"
- call assert_false(1, "Can't open channel")
+ call assert_report("Can't open channel")
return
endif
let g:Ch_close_ret = ''
call ch_log('Test_close_lambda()')
call s:run_server('Ch_test_close_lambda')
endfunc
-
-" Uncomment this to see what happens, output is in src/testdir/channellog.
-" call ch_logfile('channellog', 'w')
\ '.',
\ ])
catch
- call assert_false(1, "Can't define function")
+ call assert_report("Can't define function")
endtry
try
call DefineFunction('T_Append', [
\ 'append',
\ 'abc',
\ ])
- call assert_false(1, "Shouldn't be able to define function")
+ call assert_report("Shouldn't be able to define function")
catch
call assert_exception('Vim(function):E126: Missing :endfunction')
endtry
\ '.',
\ ])
catch
- call assert_false(1, "Can't define function")
+ call assert_report("Can't define function")
endtry
try
call DefineFunction('T_Change', [
\ 'change',
\ 'abc',
\ ])
- call assert_false(1, "Shouldn't be able to define function")
+ call assert_report("Shouldn't be able to define function")
catch
call assert_exception('Vim(function):E126: Missing :endfunction')
endtry
\ '.',
\ ])
catch
- call assert_false(1, "Can't define function")
+ call assert_report("Can't define function")
endtry
try
call DefineFunction('T_Insert', [
\ 'insert',
\ 'abc',
\ ])
- call assert_false(1, "Shouldn't be able to define function")
+ call assert_report("Shouldn't be able to define function")
catch
call assert_exception('Vim(function):E126: Missing :endfunction')
endtry