Changeset View
Changeset View
Standalone View
Standalone View
src/utils/__tests__/PhutilProseDiffTestCase.php
Show First 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | $this->assertProseParts( | ||||
array( | array( | ||||
'= aaa aaa aaa aaa', | '= aaa aaa aaa aaa', | ||||
'- ,', | '- ,', | ||||
'= bbb bbb bbb bbb.', | '= bbb bbb bbb bbb.', | ||||
"+ \n\n- ccc ccc ccc!", | "+ \n\n- ccc ccc ccc!", | ||||
), | ), | ||||
pht('Diff with a removed comma and new trailing content.')); | pht('Diff with a removed comma and new trailing content.')); | ||||
$this->assertProseParts( | |||||
'[ ] Walnuts', | |||||
'[X] Walnuts', | |||||
array( | |||||
'= [', | |||||
'- ', | |||||
'+ X', | |||||
'= ] Walnuts', | |||||
), | |||||
pht('Diff adding a tickmark to a checkbox list.')); | |||||
$this->assertProseParts( | |||||
'[[ ./week49 ]]', | |||||
'[[ ./week50 ]]', | |||||
array( | |||||
'= [[ ./week', | |||||
'- 49', | |||||
'+ 50', | |||||
'= ]]', | |||||
), | |||||
pht('Diff changing a remarkup wiki link target.')); | |||||
} | } | ||||
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 20 Lines • Show All 42 Lines • Show Last 20 Lines |