Annotation of embedaddon/php/ext/standard/tests/strings/ucwords_variation3.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test ucwords() function : usage variations - single 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 single 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",ucword,"test"',
! 30: '"t""t",test, t',
! 31: '\'t \'t\',test',
! 32:
! 33: // using other white spaces
! 34: '\ttesting\ttesting\tucwords',
! 35: 'testing\rucwords testing ucwords',
! 36: 'testing\fucwords \f testing \nucwords',
! 37: '\ntesting\nucwords\n testing \n ucwords',
! 38: 'using\vvertical\vtab',
! 39:
! 40: //using special chars in sentence
! 41: 't@@#$% %test ^test &test *test +test -test',
! 42: '!test ~test `test` =test= @test@test.com',
! 43: '/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/',
! 44:
! 45: //only special chars
! 46: '!@#$%^&*()_+=-`~'
! 47: );
! 48:
! 49: // loop through the $str_array array to test ucwords on each element
! 50: $iteration = 1;
! 51: for($index = 0; $index < count($str_array); $index++) {
! 52: echo "-- Iteration $iteration --\n";
! 53: var_dump( ucwords($str_array[$index]) );
! 54: $iteration++;
! 55: }
! 56:
! 57: echo "Done\n";
! 58: ?>
! 59: --EXPECTF--
! 60: *** Testing ucwords() : usage variations ***
! 61: -- Iteration 1 --
! 62: string(18) "Testing Ucwords"
! 63: -- Iteration 2 --
! 64: string(30) "T E S T I N G U C W O R D S "
! 65: -- Iteration 3 --
! 66: string(25) "Testing Function(ucwords)"
! 67: -- Iteration 4 --
! 68: string(38) "(testing ( Function (ucwords) )a )test"
! 69: -- Iteration 5 --
! 70: string(3) "(t)"
! 71: -- Iteration 6 --
! 72: string(7) " ( T )t"
! 73: -- Iteration 7 --
! 74: string(23) ""testing",ucword,"test""
! 75: -- Iteration 8 --
! 76: string(14) ""t""t",test, T"
! 77: -- Iteration 9 --
! 78: string(11) "'t 't',test"
! 79: -- Iteration 10 --
! 80: string(27) "\ttesting\ttesting\tucwords"
! 81: -- Iteration 11 --
! 82: string(32) "Testing\rucwords Testing Ucwords"
! 83: -- Iteration 12 --
! 84: string(37) "Testing\fucwords \f Testing \nucwords"
! 85: -- Iteration 13 --
! 86: string(39) "\ntesting\nucwords\n Testing \n Ucwords"
! 87: -- Iteration 14 --
! 88: string(20) "Using\vvertical\vtab"
! 89: -- Iteration 15 --
! 90: string(42) "T@@#$% %test ^test &test *test +test -test"
! 91: -- Iteration 16 --
! 92: string(40) "!test ~test `test` =test= @test@test.com"
! 93: -- Iteration 17 --
! 94: string(40) "/test/r\test\ucwords\t\y\y\u\3 \yy\ /uu/"
! 95: -- Iteration 18 --
! 96: string(16) "!@#$%^&*()_+=-`~"
! 97: Done
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>