addon-sdk/source/python-lib/cuddlefish/tests/test_util.py

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/addon-sdk/source/python-lib/cuddlefish/tests/test_util.py	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,22 @@
     1.4 +# This Source Code Form is subject to the terms of the Mozilla Public
     1.5 +# License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 +# file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.7 +
     1.8 +
     1.9 +import unittest
    1.10 +from cuddlefish.manifest import filter_filenames, filter_dirnames
    1.11 +
    1.12 +class Filter(unittest.TestCase):
    1.13 +    def test_filter_filenames(self):
    1.14 +        names = ["foo", "bar.js", "image.png",
    1.15 +                 ".hidden", "foo~", ".foo.swp", "bar.js.swp"]
    1.16 +        self.failUnlessEqual(sorted(filter_filenames(names)),
    1.17 +                             sorted(["foo", "bar.js", "image.png"]))
    1.18 +
    1.19 +    def test_filter_dirnames(self):
    1.20 +        names = ["subdir", "data", ".git", ".hg", ".svn", "defaults"]
    1.21 +        self.failUnlessEqual(sorted(filter_dirnames(names)),
    1.22 +                             sorted(["subdir", "data", "defaults"]))
    1.23 +
    1.24 +if __name__ == '__main__':
    1.25 +    unittest.main()

mercurial