diff options
author | Alec Warner <antarus@gentoo.org> | 2006-12-08 01:57:30 +0000 |
---|---|---|
committer | Alec Warner <antarus@gentoo.org> | 2006-12-08 01:57:30 +0000 |
commit | 3cba4f460686303d6ab426585d9b726eeac3d3b7 (patch) | |
tree | 720c11f3198870ae4c39b08a888833ea049de104 /tests/test_util.py | |
parent | 3c98c0138c9e9bb0512e98a362335f82d55e8a90 (diff) | |
download | portage-3cba4f460686303d6ab426585d9b726eeac3d3b7.tar.gz portage-3cba4f460686303d6ab426585d9b726eeac3d3b7.tar.bz2 portage-3cba4f460686303d6ab426585d9b726eeac3d3b7.zip |
add some portage_util tests
svn path=/main/trunk/; revision=5217
Diffstat (limited to 'tests/test_util.py')
-rw-r--r-- | tests/test_util.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/test_util.py b/tests/test_util.py new file mode 100644 index 000000000..59d82b9ba --- /dev/null +++ b/tests/test_util.py @@ -0,0 +1,42 @@ +# test_vercmp.py -- Portage Unit Testing Functionality +# Copyright 2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id: test_vercmp.py 5213 2006-12-08 00:12:41Z antarus $ + +from unittest import TestCase, TestLoader + +class UtilTestCase(TestCase): + + def testUniqueArray(self): + pass + + def testVarexpand(self): + pass + + def testStackLists(self): + pass + + def testStackDicts(self): + pass + + def testStackDictList(self): + from portage_util import stack_dictlist + + tests = [ ({'a':'b'},{'x':'y'},False,{'a':['b'],'x':['y']}) ] + tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-*']},True,{} )) + tests.append(( {'KEYWORDS':['alpha','x86']},{'KEYWORDS':['-x86']},True,{'KEYWORDS':['alpha']} )) + for test in tests: + self.failUnless(stack_dictlist([test[0],test[1]],incremental=test[2]) == test[3], + msg="%s and %s combined, was expecting: %s and got: %s" % (test[0],test[1],test[3], + stack_dictlist([test[0],test[1]],incremental=test[2])) ) + + def testNormalizePath(self): + + from portage_util import normalize_path + path = "///foo/bar/baz" + good = "/foo/bar/baz" + self.failUnless(normalize_path(path) == good, msg="NormalizePath(%s) failed to produce %s" % (path, good)) + +def suite(): + return TestLoader().loadTestsFromTestCase(UtilTestCase) + |