From 1e1413717df6ed6809833004bf47088e021ccb46 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 20 Oct 2011 23:06:33 -0700 Subject: UpdateChangeLog: split out/test copyright regex This also fixes a case where something like "Copyright 2011 " would be replaced with "Copyright 2011-2011 ". --- pym/portage/tests/repoman/test_simple.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'pym/portage/tests/repoman') diff --git a/pym/portage/tests/repoman/test_simple.py b/pym/portage/tests/repoman/test_simple.py index 83de883e1..9dae0efda 100644 --- a/pym/portage/tests/repoman/test_simple.py +++ b/pym/portage/tests/repoman/test_simple.py @@ -14,9 +14,32 @@ from portage.process import find_binary from portage.tests import TestCase from portage.tests.resolver.ResolverPlayground import ResolverPlayground from portage.util import ensure_dirs +from repoman.utilities import _update_copyright_year class SimpleRepomanTestCase(TestCase): + def testCopyrightUpdate(self): + test_cases = ( + ( + '2011', + '# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2', + '# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2', + ), + ( + '2011', + '# Copyright 1999 Gentoo Foundation; Distributed under the GPL v2', + '# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2', + ), + ( + '1999', + '# Copyright 1999 Gentoo Foundation; Distributed under the GPL v2', + '# Copyright 1999 Gentoo Foundation; Distributed under the GPL v2', + ), + ) + + for year, before, after in test_cases: + self.assertEqual(_update_copyright_year(year, before), after) + def _must_skip(self): xmllint = find_binary("xmllint") if not xmllint: -- cgit v1.2.3-1-g7c22