-
Notifications
You must be signed in to change notification settings - Fork 41
/
expectf_details.php
91 lines (84 loc) · 2.54 KB
/
expectf_details.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
include("include/functions.php");
$TITLE = "Writing Tests [PHP-QAT: Quality Assurance Team]";
$SITE_UPDATE = date("D M d H:i:s Y T", filectime(__FILE__));
common_header();
?>
<h1>EXPECTF substitution options</h1>
<p>The --EXPECTF-- section uses a number of substitution tags for strings or digits
that appear in test case output but which may vary between test runs. The most common
example of this is to use %s and %d to match the file path and line number which are
output by PHP Warnings.</p>
<p>The substitution tags and their meanings are summarised below</p>
<table border="1">
<tr>
<th> %code </th>
<th> Meaning </th>
</tr>
<tr>
<td> %e </td>
<td> Represents a directory separator, for example / on Linux. </td>
</tr>
<tr>
<td> %s </td>
<td> One or more of anything (character or white space) except the end of line character. </td>
</tr>
<tr>
<td> %S </td>
<td> Zero or more of anything (character or white space) except the end of line character. </td>
</tr>
<tr>
<td> %a </td>
<td> One or more of anything (character or white space) including the end of line character. </td>
</tr>
<tr>
<td> %A </td>
<td> Zero or more of anything (character or white space) including the end of line character. </td>
</tr>
<tr>
<td> %w </td>
<td> Zero or more white space characters. </td>
</tr>
<tr>
<td> %i </td>
<td> A signed integer value, for example +3142, -3142. </td>
</tr>
<tr>
<td> %d </td>
<td> An unsigned integer value, for example 123456. </td>
</tr>
<tr>
<td> %x </td>
<td> One or more hexadecimal character. That is, characters in the range 0-9, a-f, A-F. </td>
</tr>
<tr>
<td> %f </td>
<td> A floating point number, for example: 3.142, -3.142, 3.142E-10, 3.142e+10. </td>
</tr>
<tr>
<td> %c </td>
<td> A single character of any sort (.) </td>
</tr>
<tr>
<td> %r...%r</td>
<td> Any string (...) enclosed between two %r will be treated as a regular expression </td>
</tr>
<tr>
<td> %unicode|string% </td>
<td> Matches the string 'unicode' in PHP6 test output and 'string' in PHP5 test output. </td>
</tr>
<tr>
<td> %binary_string_optional% </td>
<td> Matches 'Binary string' in PHP6 output, 'string' in PHP5 output. Used in PHP Warning messages. </td>
</tr>
<tr>
<td> %unicode_string_optional% </td>
<td> Matches 'Unicode string' in PHP6 output, 'string' in PHP5 output. Used in PHP Warning messages. </td>
</tr>
<tr>
<td> %u|b% </td>
<td> Matches a single 'u' in PHP6 test output where the PHP5 output from the same test has no character in that position.</td>
</tr>
</table>
<?php
common_footer();