Annotation of embedaddon/php/ext/tokenizer/tests/token_get_all_variation7.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test token_get_all() function : usage variations - with increment/decrement operators
1.1.1.2 ! misho 3: --SKIPIF--
! 4: <?php if (!extension_loaded("tokenizer")) print "skip"; ?>
1.1 misho 5: --FILE--
6: <?php
7: /* Prototype : array token_get_all(string $source)
8: * Description: splits the given source into an array of PHP languange tokens
9: * Source code: ext/tokenizer/tokenizer.c
10: */
11:
12: /*
13: * Passing 'source' argument with different increment/decrement operators to test them for token
14: * ++ - T_INC(297)
15: * -- - T_DEC(296)
16: */
17:
18: echo "*** Testing token_get_all() : 'source' string with different increment/decrement operators ***\n";
19:
20: // increment/decrement operators : '++' , '--'
21: $source = '<?php
22: $a = 10, $b = 5;
23: $a++;
24: $b--;
25: echo $a;
26: ?>';
27: var_dump( token_get_all($source));
28:
29: echo "Done"
30: ?>
31: --EXPECTF--
32: *** Testing token_get_all() : 'source' string with different increment/decrement operators ***
33: array(30) {
34: [0]=>
35: array(3) {
36: [0]=>
1.1.1.2 ! misho 37: int(%d)
1.1 misho 38: [1]=>
39: string(6) "<?php "
40: [2]=>
41: int(1)
42: }
43: [1]=>
44: array(3) {
45: [0]=>
1.1.1.2 ! misho 46: int(%d)
1.1 misho 47: [1]=>
48: string(1) "
49: "
50: [2]=>
51: int(1)
52: }
53: [2]=>
54: array(3) {
55: [0]=>
1.1.1.2 ! misho 56: int(%d)
1.1 misho 57: [1]=>
58: string(2) "$a"
59: [2]=>
60: int(2)
61: }
62: [3]=>
63: array(3) {
64: [0]=>
1.1.1.2 ! misho 65: int(%d)
1.1 misho 66: [1]=>
67: string(1) " "
68: [2]=>
69: int(2)
70: }
71: [4]=>
72: string(1) "="
73: [5]=>
74: array(3) {
75: [0]=>
1.1.1.2 ! misho 76: int(%d)
1.1 misho 77: [1]=>
78: string(1) " "
79: [2]=>
80: int(2)
81: }
82: [6]=>
83: array(3) {
84: [0]=>
1.1.1.2 ! misho 85: int(%d)
1.1 misho 86: [1]=>
87: string(2) "10"
88: [2]=>
89: int(2)
90: }
91: [7]=>
92: string(1) ","
93: [8]=>
94: array(3) {
95: [0]=>
1.1.1.2 ! misho 96: int(%d)
1.1 misho 97: [1]=>
98: string(1) " "
99: [2]=>
100: int(2)
101: }
102: [9]=>
103: array(3) {
104: [0]=>
1.1.1.2 ! misho 105: int(%d)
1.1 misho 106: [1]=>
107: string(2) "$b"
108: [2]=>
109: int(2)
110: }
111: [10]=>
112: array(3) {
113: [0]=>
1.1.1.2 ! misho 114: int(%d)
1.1 misho 115: [1]=>
116: string(1) " "
117: [2]=>
118: int(2)
119: }
120: [11]=>
121: string(1) "="
122: [12]=>
123: array(3) {
124: [0]=>
1.1.1.2 ! misho 125: int(%d)
1.1 misho 126: [1]=>
127: string(1) " "
128: [2]=>
129: int(2)
130: }
131: [13]=>
132: array(3) {
133: [0]=>
1.1.1.2 ! misho 134: int(%d)
1.1 misho 135: [1]=>
136: string(1) "5"
137: [2]=>
138: int(2)
139: }
140: [14]=>
141: string(1) ";"
142: [15]=>
143: array(3) {
144: [0]=>
1.1.1.2 ! misho 145: int(%d)
1.1 misho 146: [1]=>
147: string(1) "
148: "
149: [2]=>
150: int(2)
151: }
152: [16]=>
153: array(3) {
154: [0]=>
1.1.1.2 ! misho 155: int(%d)
1.1 misho 156: [1]=>
157: string(2) "$a"
158: [2]=>
1.1.1.2 ! misho 159: int(%d)
1.1 misho 160: }
161: [17]=>
162: array(3) {
163: [0]=>
1.1.1.2 ! misho 164: int(%d)
1.1 misho 165: [1]=>
166: string(2) "++"
167: [2]=>
1.1.1.2 ! misho 168: int(%d)
1.1 misho 169: }
170: [18]=>
171: string(1) ";"
172: [19]=>
173: array(3) {
174: [0]=>
1.1.1.2 ! misho 175: int(%d)
1.1 misho 176: [1]=>
177: string(1) "
178: "
179: [2]=>
1.1.1.2 ! misho 180: int(%d)
1.1 misho 181: }
182: [20]=>
183: array(3) {
184: [0]=>
1.1.1.2 ! misho 185: int(%d)
1.1 misho 186: [1]=>
187: string(2) "$b"
188: [2]=>
189: int(4)
190: }
191: [21]=>
192: array(3) {
193: [0]=>
1.1.1.2 ! misho 194: int(%d)
1.1 misho 195: [1]=>
196: string(2) "--"
197: [2]=>
198: int(4)
199: }
200: [22]=>
201: string(1) ";"
202: [23]=>
203: array(3) {
204: [0]=>
1.1.1.2 ! misho 205: int(%d)
1.1 misho 206: [1]=>
207: string(1) "
208: "
209: [2]=>
210: int(4)
211: }
212: [24]=>
213: array(3) {
214: [0]=>
1.1.1.2 ! misho 215: int(%d)
1.1 misho 216: [1]=>
217: string(4) "echo"
218: [2]=>
219: int(5)
220: }
221: [25]=>
222: array(3) {
223: [0]=>
1.1.1.2 ! misho 224: int(%d)
1.1 misho 225: [1]=>
226: string(1) " "
227: [2]=>
228: int(5)
229: }
230: [26]=>
231: array(3) {
232: [0]=>
1.1.1.2 ! misho 233: int(%d)
1.1 misho 234: [1]=>
235: string(2) "$a"
236: [2]=>
237: int(5)
238: }
239: [27]=>
240: string(1) ";"
241: [28]=>
242: array(3) {
243: [0]=>
1.1.1.2 ! misho 244: int(%d)
1.1 misho 245: [1]=>
246: string(1) "
247: "
248: [2]=>
249: int(5)
250: }
251: [29]=>
252: array(3) {
253: [0]=>
1.1.1.2 ! misho 254: int(%d)
1.1 misho 255: [1]=>
256: string(2) "?>"
257: [2]=>
258: int(6)
259: }
260: }
261: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>