Kazunobu Kuriyama wrote:

> Attached is a tiny, trivial supplement to test_gui.  Any comments and/or
> suggestions are welcome, as you all know, I'm not used to writing new tests
> for Vim :)

Better spend some time learning this, it avoids a lot of manual checks.

func Test_function()
+  call assert_true(1, match(execute('echo getwinposx()'), 
'\(%-1\)\|\(%\d\+\)') >= 0)
+  call assert_true(1, match(execute('echo getwinposy()'), 
'\(%-1\)\|\(%\d\+\)') >= 0)
+endfunction


I would call this Test_getwinpos()

When the GUI is running, as in this text, getwinposy() and getwinposx()
should return a non-negative value.  How about this:

    call assert_true(getwinposx() >= 0)
    call assert_true(getwinposy() >= 0)


+func Test_vim_variable()
+  if s:x11_based_gui
+    call assert_true(1, match(execute('echo v:windowid'), '\d\+') >= 0)
+  else
+    call assert_equal(0, v:windowid)
+  endif
+endfunction

There is no need to use execute() here, use v:windowid directly:

        call assert_true(v:windowid > 0)

On Windows v:windowid is set to the window handle, thus the condition
can be:
    if s:x11_based_gui || has('win32')

-- 
A parent can be arrested if his child cannot hold back a burp during a church
service.
                [real standing law in Nebraska, United States of America]

 /// 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