1--TEST--
2wordwrap() function
3--FILE--
4<?php
5
6$tests = <<<TESTS
7"12345 12345 12345 12345" === wordwrap("12345 12345 12345 12345")
8"12345 12345\\n1234567890\\n1234567890" === wordwrap("12345 12345 1234567890 1234567890",12)
9"12345\\n12345\\n12345\\n12345" === wordwrap("12345 12345 12345 12345",0)
10"12345ab12345ab12345ab12345" === wordwrap("12345 12345 12345 12345",0,"ab")
11"12345 12345ab1234567890ab1234567890" === wordwrap("12345 12345 1234567890 1234567890",12,"ab")
12"123ab123ab123" === wordwrap("123ab123ab123", 3, "ab")
13"123ab123ab123" === wordwrap("123ab123ab123", 5, "ab")
14"123ab 123ab123" === wordwrap("123  123ab123", 3, "ab")
15"123ab123ab123" === wordwrap("123 123ab123", 5, "ab")
16"123 123ab123" === wordwrap("123 123 123", 10, "ab")
17
18"123ab123ab123" === wordwrap("123ab123ab123", 3, "ab", 1)
19"123ab123ab123" === wordwrap("123ab123ab123", 5, "ab", 1)
20"123ab 12ab3ab123" === wordwrap("123  123ab123", 3, "ab", 1)
21"123 ab123ab123" === wordwrap("123  123ab123", 5, "ab", 1)
22"123  123ab 123" === wordwrap("123  123  123", 8, "ab", 1)
23"123 ab12345 ab123" === wordwrap("123  12345  123", 8, "ab", 1)
24"1ab2ab3ab4" === wordwrap("1234", 1, "ab", 1)
25
26"12345|12345|67890" === wordwrap("12345 1234567890", 5, "|", 1)
27
28"123|==1234567890|==123" === wordwrap("123 1234567890 123", 10, "|==", 1)
29
30FALSE === @wordwrap(chr(0), 0, "")
31
32TESTS;
33
34include(__DIR__ . '/../../../../tests/quicktester.inc');
35--EXPECT--
36OK
37