1 # test_vercmp.py -- Portage Unit Testing Functionality
2 # Copyright 2006 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4 # $Id: test_vercmp.py 5213 2006-12-08 00:12:41Z antarus $
6 from unittest import TestCase, TestLoader
8 class UtilTestCase(TestCase):
10 def testUniqueArray(self):
13 def testVarexpand(self):
16 def testStackLists(self):
19 def testStackDicts(self):
22 def testStackDictList(self):
23 from portage_util import stack_dictlist
25 tests = [ ({'a':'b'},{'x':'y'},False,{'a':['b'],'x':['y']}) ]
26 tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-*']},True,{} ))
27 tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-x86']},True,{'KEYWORDS':['alpha']} ))
29 self.failUnless(stack_dictlist([test[0],test[1]],incremental=test[2]) == test[3],
30 msg="%s and %s combined, was expecting: %s and got: %s" % (test[0],test[1],test[3],
31 stack_dictlist([test[0],test[1]],incremental=test[2])) )
33 def testNormalizePath(self):
35 from portage_util import normalize_path
36 path = "///foo/bar/baz"
38 self.failUnless(normalize_path(path) == good, msg="NormalizePath(%s) failed to produce %s" % (path, good))