aboutsummaryrefslogtreecommitdiff
blob: eeb0eae697c127d88004d8cd455987ee7d93fb6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Copyright 2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

from portage.tests import TestCase
from portage.versions import cpv_sort_key

class CpvSortKeyTestCase(TestCase):

	def testCpvSortKey(self):

		tests = [
			(("a/b-2_alpha", "a", "b", "a/b-2", "a/a-1", "a/b-1"),
			 ("a", "a/a-1", "a/b-1", "a/b-2_alpha", "a/b-2", "b")),
		]

		for test in tests:
			self.assertEqual(tuple(sorted(test[0], key=cpv_sort_key())), test[1])