Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/diff/prose/__tests__/PhutilProseDiffTestCase.php
<?php | <?php | ||||
final class PhutilProseDiffTestCase | final class PhutilProseDiffTestCase | ||||
extends PhabricatorTestCase { | extends PhabricatorTestCase { | ||||
public function testTrimApart() { | |||||
$map = array( | |||||
'' => array(), | |||||
'a' => array('a'), | |||||
' a ' => array( | |||||
' ', | |||||
'a', | |||||
' ', | |||||
), | |||||
' a' => array( | |||||
' ', | |||||
'a', | |||||
), | |||||
'a ' => array( | |||||
'a', | |||||
' ', | |||||
), | |||||
' a b ' => array( | |||||
' ', | |||||
'a b', | |||||
' ', | |||||
), | |||||
); | |||||
foreach ($map as $input => $expect) { | |||||
$actual = PhutilProseDifferenceEngine::trimApart($input); | |||||
$this->assertEqual( | |||||
$expect, | |||||
$actual, | |||||
pht('Trim Apart: %s', $input)); | |||||
} | |||||
} | |||||
public function testProseDiffsDistance() { | public function testProseDiffsDistance() { | ||||
$this->assertProseParts( | $this->assertProseParts( | ||||
'', | '', | ||||
'', | '', | ||||
array(), | array(), | ||||
pht('Empty')); | pht('Empty')); | ||||
$this->assertProseParts( | $this->assertProseParts( | ||||
▲ Show 20 Lines • Show All 241 Lines • Show Last 20 Lines |