1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-29 02:02:40 +01:00

Add tests for git submodules, based on current behavior

Summary:
This adds tests that detail the current behavior of `arc` in
the presence of `git` submodules.

Test Plan: No behavior change; wrote the tests such that they pass.

Reviewers: #blessed_reviewers, epriestley

Reviewed By: #blessed_reviewers, epriestley

Subscribers: Korvin, epriestley

Differential Revision: https://secure.phabricator.com/D18841
This commit is contained in:
Alex Vandiver 2017-12-22 16:29:31 -08:00
parent c784b56920
commit f34467914c
3 changed files with 24 additions and 0 deletions

View file

@ -5,6 +5,8 @@ final class ArcanistRepositoryAPIStateTestCase extends PhutilTestCase {
public function testGitStateParsing() {
if (Filesystem::binaryExists('git')) {
$this->parseState('git_basic.git.tgz');
$this->parseState('git_submodules_dirty.git.tgz');
$this->parseState('git_submodules_staged.git.tgz');
} else {
$this->assertSkipped(pht('Git is not installed'));
}
@ -99,6 +101,28 @@ final class ArcanistRepositoryAPIStateTestCase extends PhutilTestCase {
);
$this->assertEqual($expect_range, $api->getCommitRangeStatus());
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':
$expect_uncommitted = array(
'UNCOMMITTED' => $f_mod | $f_unc,