blob: a69f17c6d7ad4c25a067ec89f66f078ee48e1507 (
plain)
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
|
--TEST--
trim(), rtrim() and ltrim() functions
--FILE--
<?php
$tests = <<<TESTS
'ABC' === trim('ABC')
'ABC' === ltrim('ABC')
'ABC' === rtrim('ABC')
'ABC' === trim(" \\0\\t\\nABC \\0\\t\\n")
"ABC \\0\\t\\n" === ltrim(" \\0\\t\\nABC \\0\\t\\n")
" \\0\\t\\nABC" === rtrim(" \\0\\t\\nABC \\0\\t\\n")
" \\0\\t\\nABC \\0\\t\\n" === trim(" \\0\\t\\nABC \\0\\t\\n",'')
" \\0\\t\\nABC \\0\\t\\n" === ltrim(" \\0\\t\\nABC \\0\\t\\n",'')
" \\0\\t\\nABC \\0\\t\\n" === rtrim(" \\0\\t\\nABC \\0\\t\\n",'')
"ABC\\x50\\xC1" === trim("ABC\\x50\\xC1\\x60\\x90","\\x51..\\xC0")
"ABC\\x50" === trim("ABC\\x50\\xC1\\x60\\x90","\\x51..\\xC1")
"ABC" === trim("ABC\\x50\\xC1\\x60\\x90","\\x50..\\xC1")
"ABC\\x50\\xC1" === trim("ABC\\x50\\xC1\\x60\\x90","\\x51..\\xC0")
"ABC\\x50" === trim("ABC\\x50\\xC1\\x60\\x90","\\x51..\\xC1")
"ABC" === trim("ABC\\x50\\xC1\\x60\\x90","\\x50..\\xC1")
TESTS;
include(dirname(__FILE__) . '/../../../../tests/quicktester.inc');
--EXPECT--
OK
|