diff options
author | tessamac@chromium.org <tessamac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-25 04:28:58 +0000 |
---|---|---|
committer | tessamac@chromium.org <tessamac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-06-25 04:28:58 +0000 |
commit | 843d38b8afed835cb2fa3f846c8cf0a339fb1a82 (patch) | |
tree | 3c31d78229989cbef560a806e178edb5a7ddead2 /chrome/common/extensions/PRESUBMIT_test.py | |
parent | 8514ad15442580fc71250720b758197b2cf4111c (diff) | |
download | chromium_src-843d38b8afed835cb2fa3f846c8cf0a339fb1a82.zip chromium_src-843d38b8afed835cb2fa3f846c8cf0a339fb1a82.tar.gz chromium_src-843d38b8afed835cb2fa3f846c8cf0a339fb1a82.tar.bz2 |
Allow generated docs to have extra lines.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/7261002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@90485 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/PRESUBMIT_test.py')
-rwxr-xr-x | chrome/common/extensions/PRESUBMIT_test.py | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/chrome/common/extensions/PRESUBMIT_test.py b/chrome/common/extensions/PRESUBMIT_test.py index d87e7c4..4776d9c 100755 --- a/chrome/common/extensions/PRESUBMIT_test.py +++ b/chrome/common/extensions/PRESUBMIT_test.py @@ -345,11 +345,20 @@ class TestPresubmit(unittest.TestCase): self.assertTrue(PRESUBMIT._ChangesMatch(af1, af2)) self.assertTrue(PRESUBMIT._ChangesMatch(af2, af1)) + def testChangesMatch_DifferentOrder(self): + af = FakeAffectedFile(changed_contents=[(1, 'foo'), (2, 'bar')]) + af2 = FakeAffectedFile(changed_contents=[(1, 'bar'), (2, 'foo')]) + self.assertFalse(PRESUBMIT._ChangesMatch(af, af2)) + self.assertFalse(PRESUBMIT._ChangesMatch(af2, af)) + def testChangesMatch_DifferentLength(self): - af1 = FakeAffectedFile(changed_contents=[(1, 'foo'), (14, 'bar')]) - af2 = FakeAffectedFile(changed_contents=[(14, 'bar')]) - self.assertFalse(PRESUBMIT._ChangesMatch(af1, af2)) - self.assertFalse(PRESUBMIT._ChangesMatch(af2, af1)) + af = FakeAffectedFile(changed_contents=[(14, 'bar'), (15, 'qxxy')]) + af_extra = FakeAffectedFile(changed_contents=[(1, 'foo'), (14, 'bar'), + (23, 'baz'), (25, 'qxxy')]) + # The generated file (first arg) may have extra lines. + self.assertTrue(PRESUBMIT._ChangesMatch(af_extra, af)) + # But not the static file (second arg). + self.assertFalse(PRESUBMIT._ChangesMatch(af, af_extra)) def testChangesMatch_SameLengthButDifferentText(self): af1 = FakeAffectedFile(changed_contents=[(1, 'foo'), (14, 'bar')]) @@ -362,9 +371,20 @@ class TestPresubmit(unittest.TestCase): af_plus = FakeAffectedFile(changed_contents=[(6, 'foo'), (9, '<b>bar</b>')]) # The generated file (first arg) can have extra formatting. self.assertTrue(PRESUBMIT._ChangesMatch(af_plus, af)) - # But not the static file (second arg) + # But not the static file (second arg). self.assertFalse(PRESUBMIT._ChangesMatch(af, af_plus)) + def testChangesMatch_DuplicateLines(self): + af = FakeAffectedFile(changed_contents=[(1, 'foo'), (2, 'bar')]) + af_dups = FakeAffectedFile(changed_contents=[(7, 'foo'), (8, 'foo'), + (9, 'bar')]) + # Duplciate lines in the generated file (first arg) will be ignored + # like extra lines. + self.assertTrue(PRESUBMIT._ChangesMatch(af_dups, af)) + # Duplicate lines in static file (second arg) must each have a matching + # line in the generated file. + self.assertFalse(PRESUBMIT._ChangesMatch(af, af_dups)) + def testSampleZipped_ZipInAffectedFiles(self): sample_file = FakeAffectedFile( local_path='chrome/common/extensions/docs/examples/foo/bar/baz.jpg') |