comparison src/testdir/test_quotestar.vim @ 13808:16a062cf08c2 v8.0.1776

patch 8.0.1776: in tests, when WaitFor() fails it doesn't say why commit https://github.com/vim/vim/commit/0e9d1ae3216a5940b36bb56d155fb300b2e55b00 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Apr 30 14:28:24 2018 +0200 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().
author Christian Brabandt <cb@256bit.org>
date Mon, 30 Apr 2018 14:30:07 +0200
parents 87ffb7f85b28
children 3b5d401a58ce
comparison
equal deleted inserted replaced
13807:8c2a02b287ee 13808:16a062cf08c2
52 let name = 'XVIMCLIPBOARD' 52 let name = 'XVIMCLIPBOARD'
53 53
54 " Make sure a previous server has exited 54 " Make sure a previous server has exited
55 try 55 try
56 call remote_send(name, ":qa!\<CR>") 56 call remote_send(name, ":qa!\<CR>")
57 call WaitFor('serverlist() !~ "' . name . '"')
58 catch /E241:/ 57 catch /E241:/
59 endtry 58 endtry
60 call assert_notmatch(name, serverlist()) 59 call WaitForAssert({-> assert_notmatch(name, serverlist())})
61 60
62 let cmd .= ' --servername ' . name 61 let cmd .= ' --servername ' . name
63 let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'}) 62 let job = job_start(cmd, {'stoponexit': 'kill', 'out_io': 'null'})
64 call WaitFor({-> job_status(job) == "run"}) 63 call WaitForAssert({-> assert_equal("run", job_status(job))})
65 64
66 " Takes a short while for the server to be active. 65 " Takes a short while for the server to be active.
67 call WaitFor('serverlist() =~ "' . name . '"') 66 call WaitForAssert({-> assert_match(name, serverlist())})
68 67
69 " Wait for the server to be up and answering requests. One second is not 68 " Wait for the server to be up and answering requests. One second is not
70 " always sufficient. 69 " always sufficient.
71 call WaitFor('remote_expr("' . name . '", "v:version", "", 2) != ""') 70 call WaitForAssert({-> assert_notequal('', remote_expr(name, "v:version", "", 2))})
72 71
73 " Clear the *-register of this vim instance and wait for it to be picked up 72 " Clear the *-register of this vim instance and wait for it to be picked up
74 " by the server. 73 " by the server.
75 let @* = 'no' 74 let @* = 'no'
76 call remote_foreground(name) 75 call remote_foreground(name)
77 call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "no"') 76 call WaitForAssert({-> assert_equal("no", remote_expr(name, "@*", "", 1))})
78 77
79 " Set the * register on the server. 78 " Set the * register on the server.
80 call remote_send(name, ":let @* = 'yes'\<CR>") 79 call remote_send(name, ":let @* = 'yes'\<CR>")
81 call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "yes"') 80 call WaitForAssert({-> assert_equal("yes", remote_expr(name, "@*", "", 1))})
82 81
83 " Check that the *-register of this vim instance is changed as expected. 82 " Check that the *-register of this vim instance is changed as expected.
84 call WaitFor('@* == "yes"') 83 call WaitForAssert({-> assert_equal("yes", @*)})
85 84
86 " Handle the large selection over 262040 byte. 85 " Handle the large selection over 262040 byte.
87 let length = 262044 86 let length = 262044
88 let sample = 'a' . repeat('b', length - 2) . 'c' 87 let sample = 'a' . repeat('b', length - 2) . 'c'
89 let @* = sample 88 let @* = sample
107 call remote_send(name, ":call test_ignore_error('E285') | gui -f\<CR>") 106 call remote_send(name, ":call test_ignore_error('E285') | gui -f\<CR>")
108 else 107 else
109 call remote_send(name, ":gui -f\<CR>") 108 call remote_send(name, ":gui -f\<CR>")
110 endif 109 endif
111 " Wait for the server in the GUI to be up and answering requests. 110 " Wait for the server in the GUI to be up and answering requests.
112 call WaitFor('remote_expr("' . name . '", "has(\"gui_running\")", "", 1) =~ "1"') 111 call WaitForAssert({-> assert_match("1", remote_expr(name, "has('gui_running')", "", 1))})
113 112
114 call remote_send(name, ":let @* = 'maybe'\<CR>") 113 call remote_send(name, ":let @* = 'maybe'\<CR>")
115 call WaitFor('remote_expr("' . name . '", "@*", "", 1) == "maybe"') 114 call WaitForAssert({-> assert_equal("maybe", remote_expr(name, "@*", "", 2))})
116 call assert_equal('maybe', remote_expr(name, "@*", "", 2))
117 115
118 call assert_equal('maybe', @*) 116 call assert_equal('maybe', @*)
119 endif 117 endif
120 118
121 call remote_send(name, ":qa!\<CR>") 119 call remote_send(name, ":qa!\<CR>")
122 try 120 try
123 call WaitFor({-> job_status(job) == "dead"}) 121 call WaitForAssert({-> assert_equal("dead", job_status(job))})
124 finally 122 finally
125 if job_status(job) != 'dead' 123 if job_status(job) != 'dead'
126 call assert_report('Server did not exit') 124 call assert_report('Server did not exit')
127 call job_stop(job, 'kill') 125 call job_stop(job, 'kill')
128 endif 126 endif