[PATCH] Invalid closing parenthesis in test62.in

38 views
Skip to first unread message

ZyX

unread,
Jul 14, 2013, 5:00:17 AM7/14/13
to vim...@googlegroups.com
diff -r d338481e84f8 src/testdir/test62.in
--- a/src/testdir/test62.in Вс. июля 14 12:43:49 2013 +0400
+++ b/src/testdir/test62.in Вс. июля 14 12:58:03 2013 +0400
@@ -36,7 +36,7 @@ STARTTEST
:call settabvar(2, 'val_list', ['red', 'blue', 'green'])
:"
:let test_status = 'gettabvar: fail'
-:if gettabvar(2, 'val_num') == 100 && gettabvar(2, 'val_str') == 'SetTabVar test') && gettabvar(2, 'val_list') == ['red', 'blue', 'green'])
+:if gettabvar(2, 'val_num') == 100 && gettabvar(2, 'val_str') == 'SetTabVar test' && gettabvar(2, 'val_list') == ['red', 'blue', 'green']
: let test_status = 'gettabvar: pass'
:endif
:call append(line('$'), test_status)

ZyX

unread,
Jul 14, 2013, 5:15:06 AM7/14/13
to vim...@googlegroups.com
With -bar `"` is taken as comment leader.

# HG changeset patch
# User ZyX <kp-...@ya.ru>
# Date 1373793228 -14400
# Sun Jul 14 13:13:48 2013 +0400
# Branch extended-funcref
# Node ID a9be4fd3f08625f765c212cfca3f523edf9f0085
# Parent 5c6d4d17d710cfb220c391636b8138238277883e
Fixed test62

diff --git a/src/testdir/test62.in b/src/testdir/test62.in
--- a/src/testdir/test62.in
+++ b/src/testdir/test62.in
@@ -146,7 +146,7 @@
endif
let t:a='c'
call add(g:r, join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')))
- C call map(range(1, tabpagenr('$')), 'settabvar(v:val, "a", v:val*2)')
+ C call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)')
call add(g:r, join(map(range(1, tabpagenr('$')), 'gettabvar(v:val, "a")')))
let w:a='a'
C vsplit
@@ -161,7 +161,7 @@
let g:r+=['BufLeave', 'WinLeave', 'TabLeave', 'WinEnter', 'TabEnter', 'BufEnter']
endif
call add(g:r, join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')))
- C call map(copy(winr), 'settabwinvar('.tabn.', v:val, "a", v:val*2)')
+ C call map(copy(winr), 'settabwinvar('.tabn.', v:val, ''a'', v:val*2)')
call add(g:r, join(map(copy(winr), 'gettabwinvar('.tabn.', v:val, "a")')))
if hasau
augroup TabDestructive
diff --git a/src/testdir/test62.ok b/src/testdir/test62.ok
--- a/src/testdir/test62.ok
+++ b/src/testdir/test62.ok
@@ -31,8 +31,8 @@
BufLeave
BufEnter
a b c
-=== call map(range(1, tabpagenr('$')), 'settabvar(v:val, ===
-a b c
+=== call map(range(1, tabpagenr('$')), 'settabvar(v:val, ''a'', v:val*2)') ===
+2 4 6
=== vsplit ===
WinLeave
WinEnter
@@ -44,8 +44,8 @@
TabEnter
BufEnter
a a
-=== call map(copy(winr), 'settabwinvar('.tabn.', v:val, ===
-a a
+=== call map(copy(winr), 'settabwinvar('.tabn.', v:val, ''a'', v:val*2)') ===
+2 4
=== tabnext 3 ===
BufLeave
WinLeave

c.diff

Bram Moolenaar

unread,
Jul 14, 2013, 6:22:12 AM7/14/13
to ZyX, vim...@googlegroups.com

ZyX wrote:

> diff -r d338481e84f8 src/testdir/test62.in
> --- a/src/testdir/test62.in ��. ���� 14 12:43:49 2013 +0400
> +++ b/src/testdir/test62.in ��. ���� 14 12:58:03 2013 +0400
> @@ -36,7 +36,7 @@ STARTTEST
> :call settabvar(2, 'val_list', ['red', 'blue', 'green'])
> :"
> :let test_status = 'gettabvar: fail'
> -:if gettabvar(2, 'val_num') == 100 && gettabvar(2, 'val_str') == 'SetTabVar test') && gettabvar(2, 'val_list') == ['red', 'blue', 'green'])
> +:if gettabvar(2, 'val_num') == 100 && gettabvar(2, 'val_str') == 'SetTabVar test' && gettabvar(2, 'val_list') == ['red', 'blue', 'green']
> : let test_status = 'gettabvar: pass'
> :endif
> :call append(line('$'), test_status)

Thanks. The test did pass even with this mistake...

--
ARTHUR: I've said I'm sorry about the old woman, but from the behind you
looked ...
DENNIS: What I object to is that you automatically treat me like an inferior...
ARTHUR: Well ... I AM king.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- 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 ///

Bram Moolenaar

unread,
Jul 14, 2013, 6:22:11 AM7/14/13
to ZyX, vim...@googlegroups.com

ZyX wrote:

> With -bar `"` is taken as comment leader.

So the test was wrong all the time...

We should really have a way to verify a test breaks when there is a bug.


--
DENNIS: Oh, very nice. King, eh! I expect you've got a palace and fine
clothes and courtiers and plenty of food. And how d'you get that? By
exploiting the workers! By hanging on to outdated imperialist dogma
which perpetuates the social and economic differences in our society!

ZyX

unread,
Jul 14, 2013, 7:49:42 AM7/14/13
to vim...@googlegroups.com, ZyX
To prevent the issues tests that can be placed into sourced .vim files and wrapped in :try should be wrapped unless they are testing the errors themselves. I also completely do not understand why all tests have to be invoked by the weird and recursive construct from `dotest.in`, with “manual” quit in each test which makes forcing vim not quit require at least two actions:

1. Commenting out explicit quit statement found in each test.
2. Adding `call getchar()` to prevent problems with recursion.

. They also each use Xdotest and test.out file which prevents them from being launched in parallel. There is also non-test test1 which does some setup for other tests, it should be a .vim file launched from makefile and definitely not test1 “test”.

The whole sequence to run test:

1. open testN.in
2. run dotest.in
3. define a (recursive!) mapping there
4. from the mapping write (part!) of the opened file to Xdotest
5. from the mapping source newly written Xdotest as if it was typed text
6. in the sourced file append to the testN.in
7. write part of testN.in to test.out
8. quit with explicit command in Xdotest
9. compare written test.out and copy it to a separate (now test-specific) location in case of failure

sounds like a Rube Goldberg machine for me. Why recursive mapping if no recursion is possible with 8.? Why risking accidental overwrite of test*.in file? Such errors are not fatal with mercurial, but still inconvenient. Why indirect sourcing and another file if you can use comments for the header and footer (these parts are excluded at point 4.)? Why copying to a separate location in 9. if you can write there from the very beginning?

And also very “interesting” test49 with errors like “(402653184 instead of 134217728)” and no easy way to run specific subtest in the debugger.


There is the way I write tests (using http://vimpluginloader.hg.sourceforge.net/hgweb/vimpluginloader/dev-tools/file/f6fc000e885edccec0afd93bede5b1704e93c4f8/test.zsh):

0. No tests are dependent on each other. When running more then one test in parallel there is no other option as you can’t say whichever will run first; and test.zsh runs like this by default.
1. All tests are copied into an empty directory under /tmp before proceeding.
2. Features required for specific tests are described in a separate (and less verbose) file, you don’t have to write `if !has('python') | e! test.ok | wq! test.out | endif`.
3. Test output is written in files with filenames unique to each test.
4. `test*.in` are passed to -s directly, without using some weird recursive mappings and :source!. If one needs any he can add this in test.
5. `qa!` is added to `test*.in` at point 1. It is not added if it was requested not to add quits thus you can easily use environment of the failing test without any trickery with commenting out anything.
6. Because of 3. I can run tests in parallel using screen. I can even use wine to test on windows if I need.
Reply all
Reply to author
Forward
0 new messages