mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-31718 add a few more tests to check that lens and tags are properly handled
This commit is contained in:
parent
45c41bdc06
commit
7ca5dd85dc
1 changed files with 12 additions and 1 deletions
|
@ -961,12 +961,23 @@ class moodlelib_test extends UnitTestCase {
|
|||
$this->assertEqual($text, shorten_text($text)); // 30 chars by default
|
||||
$this->assertEqual("Žluťoučký koníče...", shorten_text($text, 19, true));
|
||||
$this->assertEqual("Žluťoučký ...", shorten_text($text, 19, false));
|
||||
// And try it with 2-less (that are, in bytes, the middle of a sequence)
|
||||
$this->assertEqual("Žluťoučký koní...", shorten_text($text, 17, true));
|
||||
$this->assertEqual("Žluťoučký ...", shorten_text($text, 17, false));
|
||||
|
||||
$text = "<p>Žluťoučký koníček <b>přeskočil</b> potůček</p>";
|
||||
$this->assertEqual($text, shorten_text($text, 60));
|
||||
$this->assertEqual("<p>Žluťoučký koníček ...</p>", shorten_text($text, 21));
|
||||
$this->assertEqual("<p>Žluťoučký koníče...</p>", shorten_text($text, 19, true));
|
||||
$this->assertEqual("<p>Žluťoučký ...</p>", shorten_text($text, 19, false));
|
||||
// And try it with 2-less (that are, in bytes, the middle of a sequence)
|
||||
$this->assertEqual("<p>Žluťoučký koní...</p>", shorten_text($text, 17, true));
|
||||
$this->assertEqual("<p>Žluťoučký ...</p>", shorten_text($text, 17, false));
|
||||
// And try over one tag (start/end), it does proper text len
|
||||
$this->assertEqual("<p>Žluťoučký koníček <b>př...</b></p>", shorten_text($text, 23, true));
|
||||
$this->assertEqual("<p>Žluťoučký koníček <b>přeskočil</b> pot...</p>", shorten_text($text, 34, true));
|
||||
// And in the middle of one tag
|
||||
$this->assertEqual("<p>Žluťoučký koníček <b>přeskočil...</b></p>", shorten_text($text, 30, true));
|
||||
|
||||
// Japanese
|
||||
$text = '言語設定言語設定abcdefghijkl';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue