Checkstyle handling when all lines are deleted.

It is valid to have empty modified_lines list for files
that only contain deletions. In such case we should skip
all the errors except for forced rules.

Updated the test to match the expectation.

Change-Id: I6993968b882fb6fbe2ba1f63f3b6879c3308ff34
This commit is contained in:
Aurimas Liutikas
2016-01-21 14:43:12 -08:00
parent b571663f91
commit a0e889762d
2 changed files with 6 additions and 2 deletions

View File

@@ -77,7 +77,8 @@ class TestCheckstyle(unittest.TestCase):
checkstyle.git.last_commit = mock_last_commit
def test_ShouldSkip(self):
self.assertFalse(checkstyle._ShouldSkip([], 1, TEST_RULE))
self.assertFalse(checkstyle._ShouldSkip(None, 1, TEST_RULE))
self.assertTrue(checkstyle._ShouldSkip([], 1, TEST_RULE))
self.assertFalse(checkstyle._ShouldSkip([1], 1, TEST_RULE))
self.assertFalse(checkstyle._ShouldSkip([1, 2, 3], 1, TEST_RULE))
self.assertTrue(checkstyle._ShouldSkip([1, 2, 3], 4, TEST_RULE))