Annotation of embedaddon/php/ext/tokenizer/tests/token_get_all_variation6.phpt, revision 1.1.1.2
1.1 misho 1: --TEST--
2: Test token_get_all() function : usage variations - with bitwise 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 bitwise operators to test them for token
14: * << - T_SL(287)
15: * >> - T_SR(286)
16: */
17:
18: echo "*** Testing token_get_all() : 'source' string with different bitwise operators ***\n";
19:
20: // bitwise operators : '<<' , '>>'
21: $source = '<?php
22: $a = 2, $b = 4;
23: $a = $a << 2;
24: $b = $b >> 2;
25: var_dump($a);
26: var_dump($b);
27: ?>';
28: var_dump( token_get_all($source));
29:
30: echo "Done"
31: ?>
32: --EXPECTF--
33: *** Testing token_get_all() : 'source' string with different bitwise operators ***
34: array(50) {
35: [0]=>
36: array(3) {
37: [0]=>
1.1.1.2 ! misho 38: int(%d)
1.1 misho 39: [1]=>
40: string(6) "<?php
41: "
42: [2]=>
43: int(1)
44: }
45: [1]=>
46: array(3) {
47: [0]=>
1.1.1.2 ! misho 48: int(%d)
1.1 misho 49: [1]=>
50: string(2) "$a"
51: [2]=>
52: int(2)
53: }
54: [2]=>
55: array(3) {
56: [0]=>
1.1.1.2 ! misho 57: int(%d)
1.1 misho 58: [1]=>
59: string(1) " "
60: [2]=>
61: int(2)
62: }
63: [3]=>
64: string(1) "="
65: [4]=>
66: array(3) {
67: [0]=>
1.1.1.2 ! misho 68: int(%d)
1.1 misho 69: [1]=>
70: string(1) " "
71: [2]=>
72: int(2)
73: }
74: [5]=>
75: array(3) {
76: [0]=>
1.1.1.2 ! misho 77: int(%d)
1.1 misho 78: [1]=>
79: string(1) "2"
80: [2]=>
81: int(2)
82: }
83: [6]=>
84: string(1) ","
85: [7]=>
86: array(3) {
87: [0]=>
1.1.1.2 ! misho 88: int(%d)
1.1 misho 89: [1]=>
90: string(1) " "
91: [2]=>
92: int(2)
93: }
94: [8]=>
95: array(3) {
96: [0]=>
1.1.1.2 ! misho 97: int(%d)
1.1 misho 98: [1]=>
99: string(2) "$b"
100: [2]=>
101: int(2)
102: }
103: [9]=>
104: array(3) {
105: [0]=>
1.1.1.2 ! misho 106: int(%d)
1.1 misho 107: [1]=>
108: string(1) " "
109: [2]=>
110: int(2)
111: }
112: [10]=>
113: string(1) "="
114: [11]=>
115: array(3) {
116: [0]=>
1.1.1.2 ! misho 117: int(%d)
1.1 misho 118: [1]=>
119: string(1) " "
120: [2]=>
121: int(2)
122: }
123: [12]=>
124: array(3) {
125: [0]=>
1.1.1.2 ! misho 126: int(%d)
1.1 misho 127: [1]=>
128: string(1) "4"
129: [2]=>
130: int(2)
131: }
132: [13]=>
133: string(1) ";"
134: [14]=>
135: array(3) {
136: [0]=>
1.1.1.2 ! misho 137: int(%d)
1.1 misho 138: [1]=>
139: string(1) "
140: "
141: [2]=>
142: int(2)
143: }
144: [15]=>
145: array(3) {
146: [0]=>
1.1.1.2 ! misho 147: int(%d)
1.1 misho 148: [1]=>
149: string(2) "$a"
150: [2]=>
1.1.1.2 ! misho 151: int(%d)
1.1 misho 152: }
153: [16]=>
154: array(3) {
155: [0]=>
1.1.1.2 ! misho 156: int(%d)
1.1 misho 157: [1]=>
158: string(1) " "
159: [2]=>
1.1.1.2 ! misho 160: int(%d)
1.1 misho 161: }
162: [17]=>
163: string(1) "="
164: [18]=>
165: array(3) {
166: [0]=>
1.1.1.2 ! misho 167: int(%d)
1.1 misho 168: [1]=>
169: string(1) " "
170: [2]=>
1.1.1.2 ! misho 171: int(%d)
1.1 misho 172: }
173: [19]=>
174: array(3) {
175: [0]=>
1.1.1.2 ! misho 176: int(%d)
1.1 misho 177: [1]=>
178: string(2) "$a"
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(1) " "
188: [2]=>
1.1.1.2 ! misho 189: int(%d)
1.1 misho 190: }
191: [21]=>
192: array(3) {
193: [0]=>
194: int(287)
195: [1]=>
196: string(2) "<<"
197: [2]=>
1.1.1.2 ! misho 198: int(%d)
1.1 misho 199: }
200: [22]=>
201: array(3) {
202: [0]=>
1.1.1.2 ! misho 203: int(%d)
1.1 misho 204: [1]=>
205: string(1) " "
206: [2]=>
1.1.1.2 ! misho 207: int(%d)
1.1 misho 208: }
209: [23]=>
210: array(3) {
211: [0]=>
1.1.1.2 ! misho 212: int(%d)
1.1 misho 213: [1]=>
214: string(1) "2"
215: [2]=>
1.1.1.2 ! misho 216: int(%d)
1.1 misho 217: }
218: [24]=>
219: string(1) ";"
220: [25]=>
221: array(3) {
222: [0]=>
1.1.1.2 ! misho 223: int(%d)
1.1 misho 224: [1]=>
225: string(1) "
226: "
227: [2]=>
1.1.1.2 ! misho 228: int(%d)
1.1 misho 229: }
230: [26]=>
231: array(3) {
232: [0]=>
1.1.1.2 ! misho 233: int(%d)
1.1 misho 234: [1]=>
235: string(2) "$b"
236: [2]=>
237: int(4)
238: }
239: [27]=>
240: array(3) {
241: [0]=>
1.1.1.2 ! misho 242: int(%d)
1.1 misho 243: [1]=>
244: string(1) " "
245: [2]=>
246: int(4)
247: }
248: [28]=>
249: string(1) "="
250: [29]=>
251: array(3) {
252: [0]=>
1.1.1.2 ! misho 253: int(%d)
1.1 misho 254: [1]=>
255: string(1) " "
256: [2]=>
257: int(4)
258: }
259: [30]=>
260: array(3) {
261: [0]=>
1.1.1.2 ! misho 262: int(%d)
1.1 misho 263: [1]=>
264: string(2) "$b"
265: [2]=>
266: int(4)
267: }
268: [31]=>
269: array(3) {
270: [0]=>
1.1.1.2 ! misho 271: int(%d)
1.1 misho 272: [1]=>
273: string(1) " "
274: [2]=>
275: int(4)
276: }
277: [32]=>
278: array(3) {
279: [0]=>
280: int(286)
281: [1]=>
282: string(2) ">>"
283: [2]=>
284: int(4)
285: }
286: [33]=>
287: array(3) {
288: [0]=>
1.1.1.2 ! misho 289: int(%d)
1.1 misho 290: [1]=>
291: string(1) " "
292: [2]=>
293: int(4)
294: }
295: [34]=>
296: array(3) {
297: [0]=>
1.1.1.2 ! misho 298: int(%d)
1.1 misho 299: [1]=>
300: string(1) "2"
301: [2]=>
302: int(4)
303: }
304: [35]=>
305: string(1) ";"
306: [36]=>
307: array(3) {
308: [0]=>
1.1.1.2 ! misho 309: int(%d)
1.1 misho 310: [1]=>
311: string(1) "
312: "
313: [2]=>
314: int(4)
315: }
316: [37]=>
317: array(3) {
318: [0]=>
1.1.1.2 ! misho 319: int(%d)
1.1 misho 320: [1]=>
321: string(8) "var_dump"
322: [2]=>
323: int(5)
324: }
325: [38]=>
326: string(1) "("
327: [39]=>
328: array(3) {
329: [0]=>
1.1.1.2 ! misho 330: int(%d)
1.1 misho 331: [1]=>
332: string(2) "$a"
333: [2]=>
334: int(5)
335: }
336: [40]=>
337: string(1) ")"
338: [41]=>
339: string(1) ";"
340: [42]=>
341: array(3) {
342: [0]=>
1.1.1.2 ! misho 343: int(%d)
1.1 misho 344: [1]=>
345: string(1) "
346: "
347: [2]=>
348: int(5)
349: }
350: [43]=>
351: array(3) {
352: [0]=>
1.1.1.2 ! misho 353: int(%d)
1.1 misho 354: [1]=>
355: string(8) "var_dump"
356: [2]=>
357: int(6)
358: }
359: [44]=>
360: string(1) "("
361: [45]=>
362: array(3) {
363: [0]=>
1.1.1.2 ! misho 364: int(%d)
1.1 misho 365: [1]=>
366: string(2) "$b"
367: [2]=>
368: int(6)
369: }
370: [46]=>
371: string(1) ")"
372: [47]=>
373: string(1) ";"
374: [48]=>
375: array(3) {
376: [0]=>
1.1.1.2 ! misho 377: int(%d)
1.1 misho 378: [1]=>
379: string(1) "
380: "
381: [2]=>
382: int(6)
383: }
384: [49]=>
385: array(3) {
386: [0]=>
1.1.1.2 ! misho 387: int(%d)
1.1 misho 388: [1]=>
389: string(2) "?>"
390: [2]=>
391: int(7)
392: }
393: }
394: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>