4 From: Bram Moolenaar <Bram@moolenaar.net>
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
10 Patch 7.1.071 (after 7.1.040)
11 Problem: Regexp patterns are not tested.
12 Solution: Add a basic test, to be expanded later.
13 Also add (commented-out) support for valgrind.
14 Files: src/testdir/Makefile, src/testdir/test64.in, src/testdir/test64.ok
17 *** ../vim-7.1.070/src/testdir/Makefile Thu Jul 26 22:55:11 2007
18 --- src/testdir/Makefile Tue Aug 14 15:16:08 2007
25 + # Uncomment this line for using valgrind.
26 + # The output goes into a file "valgrind.$PID" (sorry, no test number).
27 + # VALGRIND = valgrind --tool=memcheck --num-callers=15 --logfile=valgrind
29 SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
30 test7.out test8.out test9.out test10.out test11.out \
31 test12.out test13.out test14.out test15.out test17.out \
34 test43.out test44.out test45.out test46.out test47.out \
35 test48.out test49.out test51.out test52.out test53.out \
36 test54.out test55.out test56.out test57.out test58.out \
37 ! test59.out test60.out test61.out test62.out test63.out
39 SCRIPTS_GUI = test16.out
42 test43.out test44.out test45.out test46.out test47.out \
43 test48.out test49.out test51.out test52.out test53.out \
44 test54.out test55.out test56.out test57.out test58.out \
45 ! test59.out test60.out test61.out test62.out test63.out \
48 SCRIPTS_GUI = test16.out
54 -rm -f $*.failed tiny.vim small.vim mbyte.vim test.ok X* viminfo
55 ! $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in
56 @/bin/sh -c "if diff test.out $*.ok; \
57 then mv -f test.out $*.out; \
62 -rm -f $*.failed tiny.vim small.vim mbyte.vim test.ok X* viminfo
63 ! $(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in
64 @/bin/sh -c "if diff test.out $*.ok; \
65 then mv -f test.out $*.out; \
70 # Sleep a moment to avoid that the xterm title is messed up
72 ! -$(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in
73 @/bin/sh -c "if test -f test.out; then\
74 if diff test.out $*.ok; \
75 then mv -f test.out $*.out; \
78 # Sleep a moment to avoid that the xterm title is messed up
80 ! -$(VALGRIND) $(VIMPROG) -u unix.vim -U NONE --noplugin -s dotest.in $*.in
81 @/bin/sh -c "if test -f test.out; then\
82 if diff test.out $*.ok; \
83 then mv -f test.out $*.out; \
84 *** ../vim-7.1.070/src/testdir/test64.in Tue Aug 14 17:26:28 2007
85 --- src/testdir/test64.in Tue Aug 14 16:03:44 2007
89 + Test for regexp patterns.
91 + A pattern that gives the expected result produces OK, so that we know it was
96 + :" tl is a List of Lists with:
98 + :" text to test the pattern on
99 + :" expected match (optional)
100 + :" expected submatch 1 (optional)
101 + :" expected submatch 2 (optional)
103 + :" When there is no match use only the first two items.
105 + :call add(tl, ['b', 'abcdef', 'b'])
106 + :call add(tl, ['bc*', 'abccccdef', 'bcccc'])
107 + :call add(tl, ['bc\{-}', 'abccccdef', 'b'])
108 + :call add(tl, ['bc\{-}\(d\)', 'abccccdef', 'bccccd', 'd'])
109 + :call add(tl, ['x', 'abcdef'])
112 + : let l = matchlist(t[1], t[0])
113 + :" check the match itself
114 + : if len(l) == 0 && len(t) > 2
115 + : $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", did not match, expected: \"' . t[2] . '\"'
116 + : elseif len(l) > 0 && len(t) == 2
117 + : $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", match: \"' . l[0] . '\", expected no match'
118 + : elseif len(t) > 2 && l[0] != t[2]
119 + : $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", match: \"' . l[0] . '\", expected: \"' . t[2] . '\"'
124 + :" check all the nine submatches
125 + : for i in range(1, 9)
126 + : if len(t) <= i + 2
132 + : $put ='ERROR: pat: \"' . t[0] . '\", text: \"' . t[1] . '\", submatch ' . i . ': \"' . l[i] . '\", expected: \"' . e . '\"'
137 + :/^Results/,$wq! test.out
141 *** ../vim-7.1.070/src/testdir/test64.ok Tue Aug 14 17:26:28 2007
142 --- src/testdir/test64.ok Tue Aug 14 16:01:47 2007
152 *** ../vim-7.1.070/src/version.c Tue Aug 14 16:57:04 2007
153 --- src/version.c Tue Aug 14 17:25:20 2007
157 { /* Add new patch number below this line */
163 hundred-and-one symptoms of being an internet addict:
164 150. You find yourself counting emoticons to get to sleep.
166 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
167 /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
168 \\\ download, build and distribute -- http://www.A-A-P.org ///
169 \\\ help me help AIDS victims -- http://ICCF-Holland.org ///