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__"
33 from UserDict import UserDict
39 from SCons.Defaults import *
41 class DefaultsTestCase(unittest.TestCase):
42 def test_mkdir_func0(self):
43 test = TestCmd.TestCmd(workdir = '')
45 subdir2 = test.workpath('sub', 'dir1', 'dir2')
48 mkdir_func(subdir2) # 2nd time should be OK too
50 def test_mkdir_func1(self):
51 test = TestCmd.TestCmd(workdir = '')
53 subdir1 = test.workpath('sub', 'dir1')
54 subdir2 = test.workpath('sub', 'dir1', 'dir2')
55 # No error if asked to create existing dir
60 def test_mkdir_func2(self):
61 test = TestCmd.TestCmd(workdir = '')
63 subdir1 = test.workpath('sub', 'dir1')
64 subdir2 = test.workpath('sub', 'dir1', 'dir2')
65 file = test.workpath('sub', 'dir1', 'dir2', 'file')
67 # make sure it does error if asked to create a dir
68 # where there's already a file
70 test.write(file, "test\n")
76 fail("expected os.error")
79 if __name__ == "__main__":
80 suite = unittest.TestSuite()
81 tclasses = [ DefaultsTestCase,
83 for tclass in tclasses:
84 names = unittest.getTestCaseNames(tclass, 'test_')
85 suite.addTests(list(map(tclass, names)))
86 if not unittest.TextTestRunner().run(suite).wasSuccessful():
91 # indent-tabs-mode:nil
93 # vim: set expandtab tabstop=4 shiftwidth=4: