Skip to content

Commit 07e1dea

Browse files
authored
Chip away at more coverage gaps (#799)
1 parent 38673b3 commit 07e1dea

26 files changed

+1823
-794
lines changed

RunTest

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,9 @@ checkresult()
197197

198198
checkspecial()
199199
{
200+
expect=${2:-0}
200201
$sim $valgrind $vjs $pcre2test $1 >>testSoutput
201-
if [ $? -ne 0 ] ; then
202+
if [ $? -ne "$expect" ] ; then
202203
echo "** pcre2test $1 failed - check testSoutput"
203204
yield=1
204205
return 1
@@ -538,16 +539,23 @@ for bmode in "$test8" "$test16" "$test32"; do
538539
echo ' abc' >>testSinput
539540
echo '' >testSoutput
540541
saverc=0
541-
checkspecial '-C' || saverc=$?
542+
checkspecial "$bmode -C" || saverc=$?
542543
checkspecial '--help' || saverc=$?
543544
checkspecial "$bmode testSinput" || saverc=$?
544545
checkspecial "$bmode $testdata/testinputheap" || saverc=$?
545546
if [ $support_setstack -eq 0 ] ; then
546547
checkspecial "$bmode -S 1 -t 10 testSinput" || saverc=$?
547548
fi
549+
checkspecial "$bmode reallydoesnotexist" 1 || saverc=$?
550+
checkspecial "$bmode testSinput reallydoesnotexist/outfile" 1 || saverc=$?
551+
checkspecial "$bmode -pattern debug testSinput" || saverc=$?
552+
checkspecial "$bmode -pattern INVALID testSinput" 1 2>/dev/null || saverc=$?
553+
checkspecial "$bmode -subject notempty testSinput" || saverc=$?
554+
checkspecial "$bmode -subject INVALID testSinput" 1 2>/dev/null || saverc=$?
548555
checkspecial -LM || saverc=$?
549556
checkspecial -LP || saverc=$?
550557
checkspecial -LS || saverc=$?
558+
checkspecial "$bmode -unittest" || saverc=$?
551559
if [ $saverc -eq 0 ] ; then
552560
echo " OK"
553561
fi

doc/html/pcre2_substring_length_byname.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ <h2>
3131
<pre>
3232
<i>match_data</i> The match data block for the match
3333
<i>name</i> The substring name
34-
<i>length</i> Where to return the length
34+
<i>length</i> Where to return the length, or NULL
3535
</pre>
36-
The yield is zero on success, or an error code if the substring is not found.
36+
The third argument may be NULL if all you want to know is whether or not a
37+
substring is set. The yield is zero on success, or a negative error code
38+
otherwise.
3739
</p>
3840
<p>
3941
There is a complete description of the PCRE2 native API in the

doc/html/pcre2test.html

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,12 @@ <h2><a name="SEC4" href="#TOC1">COMMAND LINE OPTIONS</a></h2>
282282
-C and any -Lx options are present, whichever is first is recognized.
283283
</p>
284284
<p>
285+
<b>-malloc</b>
286+
Exercise malloc() failures, by first counting the number of calls made to malloc
287+
during pattern compilation and matching, then re-running the compilation and
288+
matching that many times, exercising a failure of each malloc() call.
289+
</p>
290+
<p>
285291
<b>-pattern</b> <i>modifier-list</i>
286292
Behave as if each pattern line contains the given modifiers.
287293
</p>
@@ -318,10 +324,9 @@ <h2><a name="SEC4" href="#TOC1">COMMAND LINE OPTIONS</a></h2>
318324
the total times for all compiles and matches are output.
319325
</p>
320326
<p>
321-
<b>-malloc</b>
322-
Exercise malloc() failures, by first counting the number of calls made to malloc
323-
during pattern compilation and matching, then re-running the compilation and
324-
matching that many times, exercising a failure of each malloc() call.
327+
<b>-unittest</b>
328+
Run a fixed set of additional tests of the PCRE2 API which are not driven by
329+
the test input files, and then exit.
325330
</p>
326331
<p>
327332
<b>-version</b>

doc/pcre2_substring_length_byname.3

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ The arguments are:
1919
.sp
2020
\fImatch_data\fP The match data block for the match
2121
\fIname\fP The substring name
22-
\fIlength\fP Where to return the length
22+
\fIlength\fP Where to return the length, or NULL
2323
.sp
24-
The yield is zero on success, or an error code if the substring is not found.
24+
The third argument may be NULL if all you want to know is whether or not a
25+
substring is set. The yield is zero on success, or a negative error code
26+
otherwise.
2527
.P
2628
There is a complete description of the PCRE2 native API in the
2729
.\" HREF

doc/pcre2test.1

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,11 @@ List scripts: write a list of recognized Unicode script names to the standard
236236
output, then exit with zero exit code. All other options are ignored. If both
237237
-C and any -Lx options are present, whichever is first is recognized.
238238
.TP 10
239+
\fB-malloc\fP
240+
Exercise malloc() failures, by first counting the number of calls made to malloc
241+
during pattern compilation and matching, then re-running the compilation and
242+
matching that many times, exercising a failure of each malloc() call.
243+
.TP 10
239244
\fB-pattern\fP \fImodifier-list\fP
240245
Behave as if each pattern line contains the given modifiers.
241246
.TP 10
@@ -265,10 +270,9 @@ compile phase.
265270
These behave like \fB-t\fP and \fB-tm\fP, but in addition, at the end of a run,
266271
the total times for all compiles and matches are output.
267272
.TP 10
268-
\fB-malloc\fP
269-
Exercise malloc() failures, by first counting the number of calls made to malloc
270-
during pattern compilation and matching, then re-running the compilation and
271-
matching that many times, exercising a failure of each malloc() call.
273+
\fB-unittest\fP
274+
Run a fixed set of additional tests of the PCRE2 API which are not driven by
275+
the test input files, and then exit.
272276
.TP 10
273277
\fB-version\fP
274278
Output the PCRE2 version number and then exit.

0 commit comments

Comments
 (0)