diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-09-20 19:19:46 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-09-21 08:43:07 -0400 |
commit | 2a7ffc6567097232f5e12b6d3dc6483748eaad0a (patch) | |
tree | 491f43a53bb98159657de167c5ff437ea1a839d9 | |
parent | 3878b0822e4a7e76fcc741d739bd399915920a4e (diff) | |
download | rneovim-2a7ffc6567097232f5e12b6d3dc6483748eaad0a.tar.gz rneovim-2a7ffc6567097232f5e12b6d3dc6483748eaad0a.tar.bz2 rneovim-2a7ffc6567097232f5e12b6d3dc6483748eaad0a.zip |
vim-patch:8.0.1776: in tests, when WaitFor() fails it doesn't say why
Problem: In tests, when WaitFor() fails it doesn't say why.
Solution: Turn a few more WaitFor() into WaitForAssert().
https://github.com/vim/vim/commit/0e9d1ae3216a5940b36bb56d155fb300b2e55b00
-rw-r--r-- | src/nvim/testdir/test_popup.vim | 9 | ||||
-rw-r--r-- | src/nvim/testdir/test_quotestar.vim | 22 | ||||
-rw-r--r-- | src/nvim/testdir/test_timers.vim | 6 |
3 files changed, 16 insertions, 21 deletions
diff --git a/src/nvim/testdir/test_popup.vim b/src/nvim/testdir/test_popup.vim index 4806bb1855..c63269e5d2 100644 --- a/src/nvim/testdir/test_popup.vim +++ b/src/nvim/testdir/test_popup.vim @@ -681,18 +681,15 @@ func Test_popup_and_window_resize() call term_sendkeys(buf, "\<c-v>") call term_wait(buf, 100) " popup first entry "!" must be at the top - call WaitFor({-> term_getline(buf, 1) =~ "^!"}) - call assert_match('^!\s*$', term_getline(buf, 1)) + call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, 1))}) exe 'resize +' . (h - 1) call term_wait(buf, 100) redraw! " popup shifted down, first line is now empty - call WaitFor({-> term_getline(buf, 1) == ""}) - call assert_equal('', term_getline(buf, 1)) + call WaitForAssert({-> assert_equal('', term_getline(buf, 1))}) sleep 100m " popup is below cursor line and shows first match "!" - call WaitFor({-> term_getline(buf, term_getcursor(buf)[0] + 1) =~ "^!"}) - call assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0] + 1)) + call WaitForAssert({-> assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0] + 1))}) " cursor line also shows ! call assert_match('^!\s*$', term_getline(buf, term_getcursor(buf)[0])) bwipe! diff --git a/src/nvim/testdir/test_quotestar.vim b/src/nvim/testdir/test_quotestar.vim index b83fbe40e8..ce5a9ee827 100644 --- a/src/nvim/testdir/test_quotestar.vim +++ b/src/nvim/testdir/test_quotestar.vim @@ -54,34 +54,33 @@ func Do_test_quotestar_for_x11() " Make sure a previous server has exited try call remote_send(name, ":qa!\<CR>") - call WaitFor('serverlist() !~ "' . name . '"') catch /E241:/ endtry - call assert_notmatch(name, serverlist()) + call WaitForAssert({-> assert_notmatch(name, serverlist())}) let cmd .= ' --servername ' . name let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) - call WaitFor({-> job_status(job) == "run"}) + call WaitForAssert({-> assert_equal("run", job_status(job))}) " Takes a short while for the server to be active. - call WaitFor('serverlist() =~ "' . name . '"') + call WaitForAssert({-> assert_match(name, serverlist())}) " Wait for the server to be up and answering requests. One second is not " always sufficient. - call WaitFor('remote_expr("' . name . '", "v:version", "", 2) != ""') + call WaitForAssert({-> assert_notequal('', remote_expr(name, "v:version", "", 2))}) " Clear the *-register of this vim instance and wait for it to be picked up " by the server. let @* = 'no' call remote_foreground(name) - call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "no"') + call WaitForAssert({-> assert_equal("no", remote_expr(name, "@*", "", 1))}) " Set the * register on the server. call remote_send(name, ":let @* = 'yes'\<CR>") - call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "yes"') + call WaitForAssert({-> assert_equal("yes", remote_expr(name, "@*", "", 1))}) " Check that the *-register of this vim instance is changed as expected. - call WaitFor('@* == "yes"') + call WaitForAssert({-> assert_equal("yes", @*)}) " Handle the large selection over 262040 byte. let length = 262044 @@ -109,18 +108,17 @@ func Do_test_quotestar_for_x11() call remote_send(name, ":gui -f\<CR>") endif " Wait for the server in the GUI to be up and answering requests. - call WaitFor('remote_expr("' . name . '", "has(\"gui_running\")", "", 1) =~ "1"') + call WaitForAssert({-> assert_match("1", remote_expr(name, "has('gui_running')", "", 1))}) call remote_send(name, ":let @* = 'maybe'\<CR>") - call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "maybe"') - call assert_equal('maybe', remote_expr(name, "@*", "", 2)) + call WaitForAssert({-> assert_equal("maybe", remote_expr(name, "@*", "", 2))}) call assert_equal('maybe', @*) endif call remote_send(name, ":qa!\<CR>") try - call WaitFor({-> job_status(job) == "dead"}) + call WaitForAssert({-> assert_equal("dead", job_status(job))}) finally if job_status(job) != 'dead' call assert_report('Server did not exit') diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index ab5d89d675..bd63d94729 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -141,7 +141,7 @@ endfunc func Test_delete_myself() let g:called = 0 let t = timer_start(10, 'StopMyself', {'repeat': -1}) - call WaitFor('g:called == 2') + call WaitForAssert({-> assert_equal(2, g:called)}) call assert_equal(2, g:called) call assert_equal([], timer_info(t)) endfunc @@ -208,7 +208,7 @@ func Test_timer_errors() let g:call_count = 0 let timer = timer_start(10, 'FuncWithError', {'repeat': -1}) " Timer will be stopped after failing 3 out of 3 times. - call WaitFor('g:call_count == 3') + call WaitForAssert({-> assert_equal(3, g:call_count)}) sleep 50m call assert_equal(3, g:call_count) endfunc @@ -226,7 +226,7 @@ func Test_timer_catch_error() let g:call_count = 0 let timer = timer_start(10, 'FuncWithCaughtError', {'repeat': 4}) " Timer will not be stopped. - call WaitFor('g:call_count == 4') + call WaitForAssert({-> assert_equal(4, g:call_count)}) sleep 50m call assert_equal(4, g:call_count) endfunc |