Mercurial > vim
comparison src/testdir/test_channel.vim @ 19249:2a017e9dc6da v8.2.0183
patch 8.2.0183: tests fail when the float feature is disabled
Commit: https://github.com/vim/vim/commit/5feabe00c47fa66d5f4c95213f150488433f78e3
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Jan 30 18:24:53 2020 +0100
patch 8.2.0183: tests fail when the float feature is disabled
Problem: Tests fail when the float feature is disabled.
Solution: Skip tests that don't work without float support.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 30 Jan 2020 18:30:04 +0100 |
parents | 2ef19eed524a |
children | 16d538568dc8 |
comparison
equal
deleted
inserted
replaced
19248:5e803caf5e9c | 19249:2a017e9dc6da |
---|---|
200 | 200 |
201 call assert_equal('ok', ch_evalexpr(handle, 'empty-request')) | 201 call assert_equal('ok', ch_evalexpr(handle, 'empty-request')) |
202 | 202 |
203 " Reading while there is nothing available. | 203 " Reading while there is nothing available. |
204 call assert_equal(v:none, ch_read(handle, {'timeout': 0})) | 204 call assert_equal(v:none, ch_read(handle, {'timeout': 0})) |
205 let start = reltime() | 205 if exists('*reltimefloat') |
206 call assert_equal(v:none, ch_read(handle, {'timeout': 333})) | 206 let start = reltime() |
207 let elapsed = reltime(start) | 207 call assert_equal(v:none, ch_read(handle, {'timeout': 333})) |
208 call assert_inrange(0.3, 0.6, reltimefloat(reltime(start))) | 208 let elapsed = reltime(start) |
209 call assert_inrange(0.3, 0.6, reltimefloat(reltime(start))) | |
210 endif | |
209 | 211 |
210 " Send without waiting for a response, then wait for a response. | 212 " Send without waiting for a response, then wait for a response. |
211 call ch_sendexpr(handle, 'wait a bit') | 213 call ch_sendexpr(handle, 'wait a bit') |
212 let resp = ch_read(handle) | 214 let resp = ch_read(handle) |
213 call assert_equal(type([]), type(resp)) | 215 call assert_equal(type([]), type(resp)) |
410 | 412 |
411 """"""""" | 413 """"""""" |
412 | 414 |
413 " Test that trying to connect to a non-existing port fails quickly. | 415 " Test that trying to connect to a non-existing port fails quickly. |
414 func Test_connect_waittime() | 416 func Test_connect_waittime() |
417 CheckFunction reltimefloat | |
418 | |
415 call ch_log('Test_connect_waittime()') | 419 call ch_log('Test_connect_waittime()') |
416 let start = reltime() | 420 let start = reltime() |
417 let handle = ch_open('localhost:9876', s:chopt) | 421 let handle = ch_open('localhost:9876', s:chopt) |
418 if ch_status(handle) != "fail" | 422 if ch_status(handle) != "fail" |
419 " Oops, port does exists. | 423 " Oops, port does exists. |
925 call job_stop(job) | 929 call job_stop(job) |
926 endtry | 930 endtry |
927 endfunc | 931 endfunc |
928 | 932 |
929 func Test_pipe_to_buffer_json() | 933 func Test_pipe_to_buffer_json() |
934 CheckFunction reltimefloat | |
935 | |
930 let job = job_start(s:python . " test_channel_pipe.py", | 936 let job = job_start(s:python . " test_channel_pipe.py", |
931 \ {'out_io': 'buffer', 'out_mode': 'json'}) | 937 \ {'out_io': 'buffer', 'out_mode': 'json'}) |
932 call assert_equal("run", job_status(job)) | 938 call assert_equal("run", job_status(job)) |
933 try | 939 try |
934 let handle = job_getchannel(job) | 940 let handle = job_getchannel(job) |
1421 endif | 1427 endif |
1422 call Resume() | 1428 call Resume() |
1423 endfunction | 1429 endfunction |
1424 | 1430 |
1425 func Test_exit_callback_interval() | 1431 func Test_exit_callback_interval() |
1432 CheckFunction reltimefloat | |
1433 | |
1426 let g:exit_cb_val = {'start': reltime(), 'end': 0, 'process': 0} | 1434 let g:exit_cb_val = {'start': reltime(), 'end': 0, 'process': 0} |
1427 let job = [s:python, '-c', 'import time;time.sleep(0.5)']->job_start({'exit_cb': 'MyExitTimeCb'}) | 1435 let job = [s:python, '-c', 'import time;time.sleep(0.5)']->job_start({'exit_cb': 'MyExitTimeCb'}) |
1428 let g:exit_cb_val.process = job_info(job).process | 1436 let g:exit_cb_val.process = job_info(job).process |
1429 call WaitFor('type(g:exit_cb_val.end) != v:t_number || g:exit_cb_val.end != 0') | 1437 call WaitFor('type(g:exit_cb_val.end) != v:t_number || g:exit_cb_val.end != 0') |
1430 let elapsed = reltimefloat(g:exit_cb_val.end) | 1438 let elapsed = reltimefloat(g:exit_cb_val.end) |
1766 call job_stop(job) | 1774 call job_stop(job) |
1767 endfunc | 1775 endfunc |
1768 | 1776 |
1769 func Test_job_start_in_timer() | 1777 func Test_job_start_in_timer() |
1770 CheckFeature timers | 1778 CheckFeature timers |
1779 CheckFeature reltimefloat | |
1771 | 1780 |
1772 func OutCb(chan, msg) | 1781 func OutCb(chan, msg) |
1773 let g:val += 1 | 1782 let g:val += 1 |
1774 endfunc | 1783 endfunc |
1775 | 1784 |