1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-11-22 06:42:41 +01:00

Add unit tests for ArcanistMergeConflictLinter.

Summary: Self explanatory. Also fixed the character offset to start at 1 instead of 0 (because the other linters seem to do this).

Test Plan: `arc unit`

Reviewers: epriestley, #blessed_reviewers

Reviewed By: epriestley, #blessed_reviewers

Subscribers: epriestley, Korvin

Differential Revision: https://secure.phabricator.com/D9626
This commit is contained in:
Joshua Spence 2014-06-20 07:59:12 +10:00
parent 2198cc2849
commit 212c41fbd0
4 changed files with 25 additions and 1 deletions

View file

@ -122,6 +122,7 @@ phutil_register_library_map(array(
'ArcanistMercurialParser' => 'repository/parser/ArcanistMercurialParser.php', 'ArcanistMercurialParser' => 'repository/parser/ArcanistMercurialParser.php',
'ArcanistMercurialParserTestCase' => 'repository/parser/__tests__/ArcanistMercurialParserTestCase.php', 'ArcanistMercurialParserTestCase' => 'repository/parser/__tests__/ArcanistMercurialParserTestCase.php',
'ArcanistMergeConflictLinter' => 'lint/linter/ArcanistMergeConflictLinter.php', 'ArcanistMergeConflictLinter' => 'lint/linter/ArcanistMergeConflictLinter.php',
'ArcanistMergeConflictLinterTestCase' => 'lint/linter/__tests__/ArcanistMergeConflictLinterTestCase.php',
'ArcanistNoEffectException' => 'exception/usage/ArcanistNoEffectException.php', 'ArcanistNoEffectException' => 'exception/usage/ArcanistNoEffectException.php',
'ArcanistNoEngineException' => 'exception/usage/ArcanistNoEngineException.php', 'ArcanistNoEngineException' => 'exception/usage/ArcanistNoEngineException.php',
'ArcanistNoLintLinter' => 'lint/linter/ArcanistNoLintLinter.php', 'ArcanistNoLintLinter' => 'lint/linter/ArcanistNoLintLinter.php',
@ -294,6 +295,7 @@ phutil_register_library_map(array(
'ArcanistMercurialAPI' => 'ArcanistRepositoryAPI', 'ArcanistMercurialAPI' => 'ArcanistRepositoryAPI',
'ArcanistMercurialParserTestCase' => 'ArcanistTestCase', 'ArcanistMercurialParserTestCase' => 'ArcanistTestCase',
'ArcanistMergeConflictLinter' => 'ArcanistLinter', 'ArcanistMergeConflictLinter' => 'ArcanistLinter',
'ArcanistMergeConflictLinterTestCase' => 'ArcanistArcanistLinterTestCase',
'ArcanistNoEffectException' => 'ArcanistUsageException', 'ArcanistNoEffectException' => 'ArcanistUsageException',
'ArcanistNoEngineException' => 'ArcanistUsageException', 'ArcanistNoEngineException' => 'ArcanistUsageException',
'ArcanistNoLintLinter' => 'ArcanistLinter', 'ArcanistNoLintLinter' => 'ArcanistLinter',

View file

@ -38,7 +38,7 @@ final class ArcanistMergeConflictLinter extends ArcanistLinter {
if (preg_match('/^(>{7}|<{7}|={7})$/', $line)) { if (preg_match('/^(>{7}|<{7}|={7})$/', $line)) {
$this->raiseLintAtLine( $this->raiseLintAtLine(
$lineno + 1, $lineno + 1,
0, 1,
self::LINT_MERGECONFLICT, self::LINT_MERGECONFLICT,
pht('This syntax indicates there is an unresolved merge conflict.')); pht('This syntax indicates there is an unresolved merge conflict.'));
} }

View file

@ -0,0 +1,12 @@
<?php
final class ArcanistMergeConflictLinterTestCase
extends ArcanistArcanistLinterTestCase {
public function testMergeConflictLint() {
$this->executeTestsInDirectory(
dirname(__FILE__).'/mergeconflict/',
new ArcanistMergeConflictLinter());
}
}

View file

@ -0,0 +1,10 @@
{
"foo": "bar",
<<<<<<< HEAD
"bar": "baz"
=======
"baz": "foo"
>>>>>>> branch2
}
~~~~~~~~~~
error:5:1