Changeset View
Changeset View
Standalone View
Standalone View
src/utils/__tests__/PhutilProseDiffTestCase.php
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | $this->assertProseParts( | ||||
'Rising quickly, she remarks:', | 'Rising quickly, she remarks:', | ||||
array( | array( | ||||
'= Rising quickly, she ', | '= Rising quickly, she ', | ||||
'- says', | '- says', | ||||
'+ remarks:', | '+ remarks:', | ||||
), | ), | ||||
pht('"Says/remarks" word edit smoothenss.')); | pht('"Says/remarks" word edit smoothenss.')); | ||||
$this->assertProseParts( | |||||
'See screenshots', | |||||
'Viewed video files', | |||||
array( | |||||
'- See screenshots', | |||||
'+ Viewed video files', | |||||
), | |||||
pht('Complete paragraph rewrite.')); | |||||
$this->assertProseParts( | |||||
'xaaax', | |||||
'xbbbx', | |||||
array( | |||||
'- xaaax', | |||||
'+ xbbbx', | |||||
), | |||||
pht('Whole word rewrite with common prefix and suffix.')); | |||||
$this->assertProseParts( | |||||
' aaa ', | |||||
' bbb ', | |||||
array( | |||||
'= ', | |||||
'- aaa', | |||||
'+ bbb', | |||||
'= ', | |||||
), | |||||
pht('Whole word rewrite with whitespace prefix and suffix.')); | |||||
} | } | ||||
private function assertProseParts($old, $new, array $expect_parts, $label) { | private function assertProseParts($old, $new, array $expect_parts, $label) { | ||||
$engine = new PhutilProseDifferenceEngine(); | $engine = new PhutilProseDifferenceEngine(); | ||||
$diff = $engine->getDiff($old, $new); | $diff = $engine->getDiff($old, $new); | ||||
$parts = $diff->getParts(); | $parts = $diff->getParts(); | ||||
Show All 10 Lines |