Christ van Willegen wrote:

> On Wed, Mar 30, 2016 at 9:07 PM, Bram Moolenaar <[email protected]> wrote:
> > +   call assert_equal('', ch_evalexpr(handle, 'close me'))
> > +   call s:waitFor('"closed" == s:d.close_ret')
> > +   call assert_equal('closed', s:d.close_ret)
> 
> How long does 's:waitFor' wait for the string to become equal? If it
> only returns if the comparison is true, the assert after that call is
> useless...

        " Wait for up to a second for "expr" to become true.
        func s:waitFor(expr)
          for i in range(100)
            try
              if eval(a:expr)
                return
              endif
            catch
            endtry
            sleep 10m
          endfor
        endfunc

It also returns when timing out, we do want a nice error message then.

-- 
I'm so disorganized my keyboard isn't even in alphabetical order!

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui