Skip to content

Commit

Permalink
Fix: Updates fixup codes and tests for issue #8
Browse files Browse the repository at this point in the history
  • Loading branch information
hidehalo committed Dec 10, 2017
1 parent 98c08ab commit a35c5a6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
9 changes: 1 addition & 8 deletions src/Features/UnicodeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,13 @@ public static function getBytesNumber($symbol)
$bytesNumber = 1;
if ($ascii > 0x7f) {
switch ($ascii & 0xf0) {
case 0xfd:
$bytesNumber = 6;
break;
case 0xf8:
$bytesNumber = 5;
break;
case 0xf0:
$bytesNumber = 4;
break;
case 0xe0:
$bytesNumber = 3;
break;
case 0xd1:
case 0xd0:
case 0xc0:
$bytesNumber = 2;
break;
}
Expand Down
15 changes: 15 additions & 0 deletions test/Unit/Utf8StringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,21 @@ public function tearDown()
unset($this->encoded, $this->decoded);
}

/**
* Issue #8
*
* @group testing
* @see https://github.com/hidehalo/emoji/issues/8
*/
public function testSpec()
{
$raw = "«";
$encoded = $this->case->encode($raw);
$decoded = $this->case->decode($encoded);
$this->assertSame($raw, $decoded);
// $this->assertSame($raw, $encoded);
}

public function testGetPattern()
{
$ret = $this->case->getPattern();
Expand Down

0 comments on commit a35c5a6

Please sign in to comment.