Skip to content

Commit

Permalink
Add failing wordwrap tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jessarcher authored Apr 17, 2024
1 parent 53a242f commit 09b73c0
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/Unit/AnsiStringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,37 @@ public function test_word_wrap(): void

$this->assertEquals($expected, (string) $parsed->wordwrap(10));
}

public function test_it_cuts_long_words_when_wrapping(): void
{
$input = "Cut long words";

$expected = <<<EOF
Cut
Lon
g w
ord
s
EOF;

$parsed = new AnsiString($input);

$this->assertEquals($expected, (string) $parsed->wordwrap(3, cut_long_words: true));
}

public function test_it_wraps_wide_characters(): void
{
$input = 'πŸ”₯ πŸ”₯ あ あ';

$expected = <<<EOF
πŸ”₯
πŸ”₯
あ
あ
EOF;

$parsed = new AnsiString($input);

$this->assertEquals($expected, (string) $parsed->wordwrap(3));
}
}

0 comments on commit 09b73c0

Please sign in to comment.