Skip to content

Commit d92c42a

Browse files
committed
Added tests.
1 parent ad4e447 commit d92c42a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/testsuites/Core/ParseTests.php

+26
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,30 @@ public function test_compareFiles() : void
6161

6262
$this->assertEquals($array[1][1], Diff::INSERTED);
6363
}
64+
65+
public function test_splitUnicodeString() : void
66+
{
67+
$split = Diff::splitCharacters('öäéç€');
68+
69+
$this->assertCount(5, $split);
70+
$this->assertSame('ö', $split[0]);
71+
$this->assertSame('ä', $split[1]);
72+
$this->assertSame('é', $split[2]);
73+
$this->assertSame('ç', $split[3]);
74+
$this->assertSame('', $split[4]);
75+
}
76+
77+
/**
78+
* @link https://github.com/Mistralys/text-diff/issues/1
79+
*/
80+
public function test_unicodeCharacters() : void
81+
{
82+
$diff = Diff::compareStrings(
83+
"Géhu – jun02 (LM).",
84+
"Géhu et al. 1984 (31) – jun02 (LM).",
85+
true
86+
);
87+
88+
$this->assertStringContainsString('<span>é</span>', $diff->toHTML());
89+
}
6490
}

0 commit comments

Comments
 (0)