4 # Permission is hereby granted, free of charge, to any person obtaining
5 # a copy of this software and associated documentation files (the
6 # "Software"), to deal in the Software without restriction, including
7 # without limitation the rights to use, copy, modify, merge, publish,
8 # distribute, sublicense, and/or sell copies of the Software, and to
9 # permit persons to whom the Software is furnished to do so, subject to
10 # the following conditions:
12 # The above copyright notice and this permission notice shall be included
13 # in all copies or substantial portions of the Software.
15 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
16 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
17 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
32 from UserDict import UserDict
38 from SCons.Defaults import *
40 class DefaultsTestCase(unittest.TestCase):
41 def test_mkdir_func0(self):
42 test = TestCmd.TestCmd(workdir = '')
44 subdir2 = test.workpath('sub', 'dir1', 'dir2')
47 mkdir_func(subdir2) # 2nd time should be OK too
49 def test_mkdir_func1(self):
50 test = TestCmd.TestCmd(workdir = '')
52 subdir1 = test.workpath('sub', 'dir1')
53 subdir2 = test.workpath('sub', 'dir1', 'dir2')
54 # No error if asked to create existing dir
59 def test_mkdir_func2(self):
60 test = TestCmd.TestCmd(workdir = '')
62 subdir1 = test.workpath('sub', 'dir1')
63 subdir2 = test.workpath('sub', 'dir1', 'dir2')
64 file = test.workpath('sub', 'dir1', 'dir2', 'file')
66 # make sure it does error if asked to create a dir
67 # where there's already a file
69 test.write(file, "test\n")
75 fail("expected os.error")
78 if __name__ == "__main__":
79 suite = unittest.TestSuite()
80 tclasses = [ DefaultsTestCase,
82 for tclass in tclasses:
83 names = unittest.getTestCaseNames(tclass, 'test_')
84 suite.addTests(list(map(tclass, names)))
85 if not unittest.TextTestRunner().run(suite).wasSuccessful():
90 # indent-tabs-mode:nil
92 # vim: set expandtab tabstop=4 shiftwidth=4: