Changeset View
Changeset View
Standalone View
Standalone View
src/repository/api/__tests__/ArcanistRepositoryAPIStateTestCase.php
<?php | <?php | ||||
final class ArcanistRepositoryAPIStateTestCase extends PhutilTestCase { | final class ArcanistRepositoryAPIStateTestCase extends PhutilTestCase { | ||||
public function testGitStateParsing() { | public function testGitStateParsing() { | ||||
if (Filesystem::binaryExists('git')) { | if (Filesystem::binaryExists('git')) { | ||||
$this->parseState('git_basic.git.tgz'); | $this->parseState('git_basic.git.tgz'); | ||||
$this->parseState('git_submodules_dirty.git.tgz'); | |||||
$this->parseState('git_submodules_staged.git.tgz'); | |||||
} else { | } else { | ||||
$this->assertSkipped(pht('Git is not installed')); | $this->assertSkipped(pht('Git is not installed')); | ||||
} | } | ||||
} | } | ||||
public function testHgStateParsing() { | public function testHgStateParsing() { | ||||
if (Filesystem::binaryExists('hg')) { | if (Filesystem::binaryExists('hg')) { | ||||
$this->parseState('hg_basic.hg.tgz'); | $this->parseState('hg_basic.hg.tgz'); | ||||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | switch ($test) { | ||||
'ADDED' => $f_add, | 'ADDED' => $f_add, | ||||
'DELETED' => $f_del, | 'DELETED' => $f_del, | ||||
'MODIFIED' => $f_mod, | 'MODIFIED' => $f_mod, | ||||
'UNCOMMITTED' => $f_add, | 'UNCOMMITTED' => $f_add, | ||||
'UNSTAGED' => $f_add, | 'UNSTAGED' => $f_add, | ||||
); | ); | ||||
$this->assertEqual($expect_range, $api->getCommitRangeStatus()); | $this->assertEqual($expect_range, $api->getCommitRangeStatus()); | ||||
break; | break; | ||||
case 'git_submodules_dirty.git.tgz': | |||||
$expect_uncommitted = array( | |||||
'.gitmodules' => $f_mod | $f_uns | $f_unc, | |||||
'added/' => $f_unt, | |||||
'deleted' => $f_del | $f_uns | $f_unc, | |||||
'modified-commit' => $f_mod | $f_uns | $f_unc, | |||||
'modified-commit-dirty' => $f_mod | $f_uns | $f_unc, | |||||
'modified-dirty' => $f_ext | $f_uns | $f_unc, | |||||
); | |||||
$this->assertEqual($expect_uncommitted, $api->getUncommittedStatus()); | |||||
break; | |||||
case 'git_submodules_staged.git.tgz': | |||||
$expect_uncommitted = array( | |||||
'.gitmodules' => $f_mod | $f_uns | $f_unc, | |||||
'added' => $f_add | $f_unc, | |||||
'deleted' => $f_del | $f_unc, | |||||
'modified-commit' => $f_mod | $f_unc, | |||||
'modified-commit-dirty' => $f_mod | $f_uns | $f_unc, | |||||
'modified-dirty' => $f_ext | $f_uns | $f_unc, | |||||
); | |||||
$this->assertEqual($expect_uncommitted, $api->getUncommittedStatus()); | |||||
break; | |||||
case 'hg_basic.hg.tgz': | case 'hg_basic.hg.tgz': | ||||
$expect_uncommitted = array( | $expect_uncommitted = array( | ||||
'UNCOMMITTED' => $f_mod | $f_unc, | 'UNCOMMITTED' => $f_mod | $f_unc, | ||||
'UNTRACKED' => $f_unt, | 'UNTRACKED' => $f_unt, | ||||
); | ); | ||||
$this->assertEqual($expect_uncommitted, $api->getUncommittedStatus()); | $this->assertEqual($expect_uncommitted, $api->getUncommittedStatus()); | ||||
$expect_range = array( | $expect_range = array( | ||||
Show All 14 Lines |