Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: commit-queue/tests/chromium_copyright_test.py

Issue 135363007: Delete public commit queue to avoid confusion after move to internal repo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « commit-queue/tests/chromium.666.json ('k') | commit-queue/tests/commit_queue_test.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: commit-queue/tests/chromium_copyright_test.py
===================================================================
--- commit-queue/tests/chromium_copyright_test.py (revision 249146)
+++ commit-queue/tests/chromium_copyright_test.py (working copy)
@@ -1,135 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""Unit tests for post_processors/chromium_copyright.py."""
-
-import datetime
-import os
-import sys
-import unittest
-
-ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
-PROJECT_DIR = os.path.join(ROOT_DIR, '..')
-sys.path.insert(0, PROJECT_DIR)
-
-import find_depot_tools # pylint: disable=W0611
-from testing_support import trial_dir
-import patch
-
-from post_processors import chromium_copyright
-
-
-GIT_NEW = (
- 'diff --git a/foo b/foo\n'
- 'new file mode 100644\n'
- 'index 0000000..5716ca5\n'
- '--- /dev/null\n'
- '+++ b/foo\n'
- '@@ -0,0 +1 @@\n'
- '+bar\n')
-
-GIT_PATCH = (
- 'diff --git a/foo3 b/foo3\n'
- 'index 257cc56..5716ca5\n'
- '--- a/foo3\n'
- '+++ b/foo3\n'
- '@@ -1 +1 @@\n'
- '-foo\n'
- '+bar\n')
-
-class CCTest(trial_dir.TestCase):
- def setUp(self):
- super(CCTest, self).setUp()
- class FakeCheckout(object):
- project_path = self.root_dir
- self.checkout = FakeCheckout()
- open(self.path('foo1'), 'w').write('bar')
-
- @staticmethod
- def get_patch():
- return patch.PatchSet([
- patch.FilePatchDelete('foo2', True),
- patch.FilePatchDiff('foo', GIT_NEW, []),
- patch.FilePatchBinary('foo1', 'data', [], True),
- patch.FilePatchDiff('foo3', GIT_PATCH, []),
- ])
-
- def path(self, base_file):
- return os.path.join(self.root_dir, base_file)
-
- def full_check(self, content, expected):
- """End-to-end test. That's all that matters."""
- foo_path = self.path('foo')
- foo3_path = self.path('foo3')
- open(foo_path, 'w').write(content)
- open(foo3_path, 'w').write(content)
- for p in self.get_patch():
- chromium_copyright.process(self.checkout, p)
- self.assertEquals(expected, open(foo_path).read())
- self.assertEquals(content, open(foo3_path).read())
-
- def test_2_times(self):
- content = (
- 'Copyright (c) 2010 The Chromium Authors. All rights reserved.\n'
- 'Copyright (c) 2010 The Chromium Authors. All rights reserved.\n')
- expected = (
- 'Copyright %s The Chromium Authors. All rights reserved.\n'
- 'Copyright (c) 2010 The Chromium Authors. All rights reserved.\n') % (
- datetime.date.today().year)
- self.full_check(content, expected)
-
- def test_5_lines(self):
- content = (
- '0\n'
- '1\n'
- '2\n'
- '3\n'
- 'Copyright (c) 2010 The Chromium Authors. All rights reserved.\n')
- expected = (
- '0\n'
- '1\n'
- '2\n'
- '3\n'
- 'Copyright %s The Chromium Authors. All rights reserved.\n') % (
- datetime.date.today().year)
- self.full_check(content, expected)
-
- def test_6_lines(self):
- content = (
- '0\n'
- '1\n'
- '2\n'
- '3\n'
- '4\n'
- 'Copyright (c) 2010 The Chromium Authors. All rights reserved.\n')
- expected = content
- self.full_check(content, expected)
-
- def test_re(self):
- input_base = 'Copyright (c) 2010 The Chromium Authors. All rights reserved.'
- input_no_copyright = ('Copyright 2010 The Chromium Authors. '
- 'All rights reserved.')
- expected_base = ('Copyright %s The Chromium Authors. All rights reserved.' %
- datetime.date.today().year)
- self.full_check(input_base, expected_base)
- self.full_check('a ' + input_base, 'a ' + expected_base)
- self.full_check('// ' + input_base, '// ' + expected_base)
- self.full_check('// ' + input_base + '\n', '// ' + expected_base + '\n')
- self.full_check(input_base + '\n', expected_base + '\n')
- self.full_check(input_no_copyright, expected_base)
- self.full_check('a ' + input_no_copyright, 'a ' + expected_base)
- self.full_check('// ' + input_no_copyright, '// ' + expected_base)
- self.full_check('// ' + input_no_copyright + '\n', '// ' + expected_base +
- '\n')
- self.full_check(input_no_copyright + '\n', expected_base + '\n')
- ## \r are not supported.
- #self.full_check(
- # '// Copyright (c) 2010 The Chromium Authors. All rights reserved.\r\n',
- # '// Copyright %s The Chromium Authors. All rights reserved.\r\n' %
- # datetime.date.today().year)
-
-
-if __name__ == '__main__':
- unittest.main()
« no previous file with comments | « commit-queue/tests/chromium.666.json ('k') | commit-queue/tests/commit_queue_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698