Changeset View
Changeset View
Standalone View
Standalone View
src/parser/__tests__/ArcanistBundleTestCase.php
Show All 27 Lines | private function loadDiff($old, $new) { | ||||
return $stdout; | return $stdout; | ||||
} | } | ||||
private function loadOneChangeBundle($old, $new) { | private function loadOneChangeBundle($old, $new) { | ||||
$diff = $this->loadDiff($old, $new); | $diff = $this->loadDiff($old, $new); | ||||
return ArcanistBundle::newFromDiff($diff); | return ArcanistBundle::newFromDiff($diff); | ||||
} | } | ||||
public function testTabEncoding() { | |||||
// See T8768. Test that we add semantic trailing tab literals to diffs | |||||
// touching files with spaces in them. This is a pain to encode using the | |||||
// support toolset here so just do it manually. | |||||
// Note that the "b/X Y.txt" line has a trailing tab literal. | |||||
$diff = <<<EODIFF | |||||
diff --git a/X Y.txt b/X Y.txt | |||||
new file mode 100644 | |||||
--- /dev/null | |||||
+++ b/X Y.txt\t | |||||
@@ -0,0 +1 @@ | |||||
+quack | |||||
EODIFF; | |||||
$bundle = ArcanistBundle::newFromDiff($diff); | |||||
$changes = $bundle->getChanges(); | |||||
$this->assertEqual(1, count($changes)); | |||||
// The path should parse as "X Y.txt" despite the trailing tab. | |||||
$change = head($changes); | |||||
$this->assertEqual('X Y.txt', $change->getCurrentPath()); | |||||
// The tab should be restored when the diff is output again. | |||||
$this->assertEqual($diff, $bundle->toGitPatch()); | |||||
} | |||||
/** | /** | ||||
* Unarchive a saved git repository and apply each commit as though via | * Unarchive a saved git repository and apply each commit as though via | ||||
* "arc patch", verifying that the resulting tree hash is identical to the | * "arc patch", verifying that the resulting tree hash is identical to the | ||||
* tree hash produced by the real commit. | * tree hash produced by the real commit. | ||||
*/ | */ | ||||
public function testGitRepository() { | public function testGitRepository() { | ||||
if (phutil_is_windows()) { | if (phutil_is_windows()) { | ||||
$this->assertSkipped(pht('This test is not supported under Windows.')); | $this->assertSkipped(pht('This test is not supported under Windows.')); | ||||
▲ Show 20 Lines • Show All 884 Lines • Show Last 20 Lines |