Annotation of embedaddon/php/ext/standard/tests/strings/ucwords_variation4.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Test ucwords() function : usage variations - double quoted string
3: --FILE--
4: <?php
5: /* Prototype : string ucwords ( string $str )
6: * Description: Uppercase the first character of each word in a string
7: * Source code: ext/standard/string.c
8: */
9:
10: /*
11: * test ucwords() with different string prepared using double quote
12: */
13:
14: echo "*** Testing ucwords() : usage variations ***\n";
15:
16: // different strings containing regular chars and special chars
17: $str_array = array(
18: // multiple spaces
19: "testing ucwords",
20: "t e s t i n g u c w o r d s ",
21:
22: // brackets in sentence
23: "testing function(ucwords)",
24: "(testing ( function (ucwords) )a )test",
25: "(t)",
26: " ( t )t",
27:
28: // using quote chars in sentence
29: "\"testing\",ucwords,\"test\"",
30: "\"t\"\"t\",test, t",
31: "\'t \'t\',test",
32: "Jack's pen",
33: "P't'y 't it's ",
34:
35: // using other white spaces
36: "\ttesting\ttesting\tucwords",
37: "\\ttesting\\ttesting\tucwords",
38: "testing\rucwords testing ucwords",
39: "testing\\rucwords testing ucwords",
40: "testing\fucwords \f testing \nucwords",
41: "testing\\fucwords \\f testing \nucwords",
42: "\ntesting\nucwords\n testing \n ucwords",
43: "\\ntesting\\nucwords\\n testing \\n ucwords",
44: "using\vvertical\vtab",
45: "using\\vvertical\\vtab",
46:
47: //using special chars in sentence
48: "t@@#$% %test ^test &test *test +test -test",
49: "!test ~test `test` =test= @test@test.com",
50: "/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/",
51:
52: //only special chars
53: "!@#$%^&*()_+=-`~"
54: );
55:
56: // loop through the $str_array array to test ucwords on each element
57: $iteration = 1;
58: for($index = 0; $index < count($str_array); $index++) {
59: echo "-- Iteration $iteration --\n";
60: var_dump( ucwords($str_array[$index]) );
61: $iteration++;
62: }
63:
64: echo "Done\n";
65: ?>
66: --EXPECTF--
67: *** Testing ucwords() : usage variations ***
68: -- Iteration 1 --
69: string(18) "Testing Ucwords"
70: -- Iteration 2 --
71: string(30) "T E S T I N G U C W O R D S "
72: -- Iteration 3 --
73: string(25) "Testing Function(ucwords)"
74: -- Iteration 4 --
75: string(38) "(testing ( Function (ucwords) )a )test"
76: -- Iteration 5 --
77: string(3) "(t)"
78: -- Iteration 6 --
79: string(7) " ( T )t"
80: -- Iteration 7 --
81: string(24) ""testing",ucwords,"test""
82: -- Iteration 8 --
83: string(14) ""t""t",test, T"
84: -- Iteration 9 --
85: string(14) "\'t \'t\',test"
86: -- Iteration 10 --
87: string(10) "Jack's Pen"
88: -- Iteration 11 --
89: string(14) "P't'y 't It's "
90: -- Iteration 12 --
91: string(24) " Testing Testing Ucwords"
92: -- Iteration 13 --
93: string(26) "\ttesting\ttesting Ucwords"
94: -- Iteration 14 --
95: string(31) "Testing
Ucwords Testing Ucwords"
96: -- Iteration 15 --
97: string(32) "Testing\rucwords Testing Ucwords"
98: -- Iteration 16 --
99: string(34) "TestingUcwords Testing
100: Ucwords"
101: -- Iteration 17 --
102: string(36) "Testing\fucwords \f Testing
103: Ucwords"
104: -- Iteration 18 --
105: string(35) "
106: Testing
107: Ucwords
108: Testing
109: Ucwords"
110: -- Iteration 19 --
111: string(39) "\ntesting\nucwords\n Testing \n Ucwords"
112: -- Iteration 20 --
113: string(18) "UsingVerticalTab"
114: -- Iteration 21 --
115: string(20) "Using\vvertical\vtab"
116: -- Iteration 22 --
117: string(42) "T@@#$% %test ^test &test *test +test -test"
118: -- Iteration 23 --
119: string(40) "!test ~test `test` =test= @test@test.com"
120: -- Iteration 24 --
121: string(37) "/test/r Est\ucwords \y\y\u \yy\ /uu/"
122: -- Iteration 25 --
123: string(16) "!@#$%^&*()_+=-`~"
124: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>