|
Karsten Hopp |
b8c892 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
b8c892 |
Subject: patch 7.1.071
|
|
Karsten Hopp |
b8c892 |
Fcc: outbox
|
|
Karsten Hopp |
b8c892 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
b8c892 |
Mime-Version: 1.0
|
|
Karsten Hopp |
b8c892 |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
b8c892 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
b8c892 |
------------
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
Patch 7.1.071 (after 7.1.040)
|
|
Karsten Hopp |
b8c892 |
Problem: Regexp patterns are not tested.
|
|
Karsten Hopp |
b8c892 |
Solution: Add a basic test, to be expanded later.
|
|
Karsten Hopp |
b8c892 |
Also add (commented-out) support for valgrind.
|
|
Karsten Hopp |
b8c892 |
Files: src/testdir/Makefile, src/testdir/test64.in, src/testdir/test64.ok
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
*** ../vim-7.1.070/src/testdir/Makefile Thu Jul 26 22:55:11 2007
|
|
Karsten Hopp |
b8c892 |
--- src/testdir/Makefile Tue Aug 14 15:16:08 2007
|
|
Karsten Hopp |
b8c892 |
***************
|
|
Karsten Hopp |
b8c892 |
*** 4,9 ****
|
|
Karsten Hopp |
b8c892 |
--- 4,13 ----
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
VIMPROG = ../vim
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
+ # Uncomment this line for using valgrind.
|
|
Karsten Hopp |
b8c892 |
+ # The output goes into a file "valgrind.$PID" (sorry, no test number).
|
|
Karsten Hopp |
b8c892 |
+ # VALGRIND = valgrind --tool=memcheck --num-callers=15 --logfile=valgrind
|
|
Karsten Hopp |
b8c892 |
+
|
|
Karsten Hopp |
b8c892 |
SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
|
|
Karsten Hopp |
b8c892 |
test7.out test8.out test9.out test10.out test11.out \
|
|
Karsten Hopp |
b8c892 |
test12.out test13.out test14.out test15.out test17.out \
|
|
Karsten Hopp |
b8c892 |
***************
|
|
Karsten Hopp |
b8c892 |
*** 15,21 ****
|
|
Karsten Hopp |
b8c892 |
test43.out test44.out test45.out test46.out test47.out \
|
|
Karsten Hopp |
b8c892 |
test48.out test49.out test51.out test52.out test53.out \
|
|
Karsten Hopp |
b8c892 |
test54.out test55.out test56.out test57.out test58.out \
|
|
Karsten Hopp |
b8c892 |
! test59.out test60.out test61.out test62.out test63.out
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
SCRIPTS_GUI = test16.out
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
--- 19,26 ----
|
|
Karsten Hopp |
b8c892 |
test43.out test44.out test45.out test46.out test47.out \
|
|
Karsten Hopp |
b8c892 |
test48.out test49.out test51.out test52.out test53.out \
|
|
Karsten Hopp |
b8c892 |
test54.out test55.out test56.out test57.out test58.out \
|
|
Karsten Hopp |
b8c892 |
! test59.out test60.out test61.out test62.out test63.out \
|
|
Karsten Hopp |
b8c892 |
! test64.out
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
SCRIPTS_GUI = test16.out
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
***************
|
|
Karsten Hopp |
b8c892 |
*** 38,44 ****
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
test1.out: test1.in
|
|
Karsten Hopp |
b8c892 |
-rm -f $*.failed tiny.vim small.vim mbyte.vim test.ok X* viminfo
|
|
Karsten Hopp |
b8c892 |
! $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in
|
|
Karsten Hopp |
b8c892 |
@/bin/sh -c "if diff test.out $*.ok; \
|
|
Karsten Hopp |
b8c892 |
then mv -f test.out $*.out; \
|
|
Karsten Hopp |
b8c892 |
else echo; \
|
|
Karsten Hopp |
b8c892 |
--- 43,49 ----
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
test1.out: test1.in
|
|
Karsten Hopp |
b8c892 |
-rm -f $*.failed tiny.vim small.vim mbyte.vim test.ok X* viminfo
|
|
Karsten Hopp |
b8c892 |
! $(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in
|
|
Karsten Hopp |
b8c892 |
@/bin/sh -c "if diff test.out $*.ok; \
|
|
Karsten Hopp |
b8c892 |
then mv -f test.out $*.out; \
|
|
Karsten Hopp |
b8c892 |
else echo; \
|
|
Karsten Hopp |
b8c892 |
***************
|
|
Karsten Hopp |
b8c892 |
*** 51,57 ****
|
|
Karsten Hopp |
b8c892 |
cp $*.ok test.ok
|
|
Karsten Hopp |
b8c892 |
# Sleep a moment to avoid that the xterm title is messed up
|
|
Karsten Hopp |
b8c892 |
@-sleep .2
|
|
Karsten Hopp |
b8c892 |
! -$(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in
|
|
Karsten Hopp |
b8c892 |
@/bin/sh -c "if test -f test.out; then\
|
|
Karsten Hopp |
b8c892 |
if diff test.out $*.ok; \
|
|
Karsten Hopp |
b8c892 |
then mv -f test.out $*.out; \
|
|
Karsten Hopp |
b8c892 |
--- 56,62 ----
|
|
Karsten Hopp |
b8c892 |
cp $*.ok test.ok
|
|
Karsten Hopp |
b8c892 |
# Sleep a moment to avoid that the xterm title is messed up
|
|
Karsten Hopp |
b8c892 |
@-sleep .2
|
|
Karsten Hopp |
b8c892 |
! -$(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in
|
|
Karsten Hopp |
b8c892 |
@/bin/sh -c "if test -f test.out; then\
|
|
Karsten Hopp |
b8c892 |
if diff test.out $*.ok; \
|
|
Karsten Hopp |
b8c892 |
then mv -f test.out $*.out; \
|
|
Karsten Hopp |
b8c892 |
*** ../vim-7.1.070/src/testdir/test64.in Tue Aug 14 17:26:28 2007
|
|
Karsten Hopp |
b8c892 |
--- src/testdir/test64.in Tue Aug 14 16:03:44 2007
|
|
Karsten Hopp |
b8c892 |
***************
|
|
Karsten Hopp |
b8c892 |
*** 0 ****
|
|
Karsten Hopp |
b8c892 |
--- 1,52 ----
|
|
Karsten Hopp |
b8c892 |
+ Test for regexp patterns.
|
|
Karsten Hopp |
b8c892 |
+
|
|
Karsten Hopp |
b8c892 |
+ A pattern that gives the expected result produces OK, so that we know it was
|
|
Karsten Hopp |
b8c892 |
+ actually tried.
|
|
Karsten Hopp |
b8c892 |
+
|
|
Karsten Hopp |
b8c892 |
+ STARTTEST
|
|
Karsten Hopp |
b8c892 |
+ :so small.vim
|
|
Karsten Hopp |
b8c892 |
+ :" tl is a List of Lists with:
|
|
Karsten Hopp |
b8c892 |
+ :" regexp pattern
|
|
Karsten Hopp |
b8c892 |
+ :" text to test the pattern on
|
|
Karsten Hopp |
b8c892 |
+ :" expected match (optional)
|
|
Karsten Hopp |
b8c892 |
+ :" expected submatch 1 (optional)
|
|
Karsten Hopp |
b8c892 |
+ :" expected submatch 2 (optional)
|
|
Karsten Hopp |
b8c892 |
+ :" etc.
|
|
Karsten Hopp |
b8c892 |
+ :" When there is no match use only the first two items.
|
|
Karsten Hopp |
b8c892 |
+ :let tl = []
|
|
Karsten Hopp |
b8c892 |
+ :call add(tl, ['b', 'abcdef', 'b'])
|
|
Karsten Hopp |
b8c892 |
+ :call add(tl, ['bc*', 'abccccdef', 'bcccc'])
|
|
Karsten Hopp |
b8c892 |
+ :call add(tl, ['bc\{-}', 'abccccdef', 'b'])
|
|
Karsten Hopp |
b8c892 |
+ :call add(tl, ['bc\{-}\(d\)', 'abccccdef', 'bccccd', 'd'])
|
|
Karsten Hopp |
b8c892 |
+ :call add(tl, ['x', 'abcdef'])
|
|
Karsten Hopp |
b8c892 |
+ :"
|
|
Karsten Hopp |
b8c892 |
+ :for t in tl
|
|
Karsten Hopp |
b8c892 |
+ : let l = matchlist(t[1], t[0])
|
|
Karsten Hopp |
b8c892 |
+ :" check the match itself
|
|
Karsten Hopp |
b8c892 |
+ : if len(l) == 0 && len(t) > 2
|
|
Karsten Hopp |
b8c892 |
+ : $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", did not match, expected: \"' . t[2] . '\"'
|
|
Karsten Hopp |
b8c892 |
+ : elseif len(l) > 0 && len(t) == 2
|
|
Karsten Hopp |
b8c892 |
+ : $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", match: \"' . l[0] . '\", expected no match'
|
|
Karsten Hopp |
b8c892 |
+ : elseif len(t) > 2 && l[0] != t[2]
|
|
Karsten Hopp |
b8c892 |
+ : $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", match: \"' . l[0] . '\", expected: \"' . t[2] . '\"'
|
|
Karsten Hopp |
b8c892 |
+ : else
|
|
Karsten Hopp |
b8c892 |
+ : $put ='OK'
|
|
Karsten Hopp |
b8c892 |
+ : endif
|
|
Karsten Hopp |
b8c892 |
+ : if len(l) > 0
|
|
Karsten Hopp |
b8c892 |
+ :" check all the nine submatches
|
|
Karsten Hopp |
b8c892 |
+ : for i in range(1, 9)
|
|
Karsten Hopp |
b8c892 |
+ : if len(t) <= i + 2
|
|
Karsten Hopp |
b8c892 |
+ : let e = ''
|
|
Karsten Hopp |
b8c892 |
+ : else
|
|
Karsten Hopp |
b8c892 |
+ : let e = t[i + 2]
|
|
Karsten Hopp |
b8c892 |
+ : endif
|
|
Karsten Hopp |
b8c892 |
+ : if l[i] != e
|
|
Karsten Hopp |
b8c892 |
+ : $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"'
|
|
Karsten Hopp |
b8c892 |
+ : endif
|
|
Karsten Hopp |
b8c892 |
+ : endfor
|
|
Karsten Hopp |
b8c892 |
+ : endif
|
|
Karsten Hopp |
b8c892 |
+ :endfor
|
|
Karsten Hopp |
b8c892 |
+ :/^Results/,$wq! test.out
|
|
Karsten Hopp |
b8c892 |
+ ENDTEST
|
|
Karsten Hopp |
b8c892 |
+
|
|
Karsten Hopp |
b8c892 |
+ Results of test64:
|
|
Karsten Hopp |
b8c892 |
*** ../vim-7.1.070/src/testdir/test64.ok Tue Aug 14 17:26:28 2007
|
|
Karsten Hopp |
b8c892 |
--- src/testdir/test64.ok Tue Aug 14 16:01:47 2007
|
|
Karsten Hopp |
b8c892 |
***************
|
|
Karsten Hopp |
b8c892 |
*** 0 ****
|
|
Karsten Hopp |
b8c892 |
--- 1,6 ----
|
|
Karsten Hopp |
b8c892 |
+ Results of test64:
|
|
Karsten Hopp |
b8c892 |
+ OK
|
|
Karsten Hopp |
b8c892 |
+ OK
|
|
Karsten Hopp |
b8c892 |
+ OK
|
|
Karsten Hopp |
b8c892 |
+ OK
|
|
Karsten Hopp |
b8c892 |
+ OK
|
|
Karsten Hopp |
b8c892 |
*** ../vim-7.1.070/src/version.c Tue Aug 14 16:57:04 2007
|
|
Karsten Hopp |
b8c892 |
--- src/version.c Tue Aug 14 17:25:20 2007
|
|
Karsten Hopp |
b8c892 |
***************
|
|
Karsten Hopp |
b8c892 |
*** 668,669 ****
|
|
Karsten Hopp |
b8c892 |
--- 668,671 ----
|
|
Karsten Hopp |
b8c892 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
b8c892 |
+ /**/
|
|
Karsten Hopp |
b8c892 |
+ 71,
|
|
Karsten Hopp |
b8c892 |
/**/
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
--
|
|
Karsten Hopp |
b8c892 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
b8c892 |
150. You find yourself counting emoticons to get to sleep.
|
|
Karsten Hopp |
b8c892 |
|
|
Karsten Hopp |
b8c892 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
b8c892 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
b8c892 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
b8c892 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|