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 class Environment(UserDict.UserDict):
34 def Detect(self, cmd):
36 def AppendENVPath(self, key, value):
39 class PlatformTestCase(unittest.TestCase):
40 def test_Platform(self):
41 """Test the Platform() function"""
42 p = SCons.Platform.Platform('cygwin')
43 assert str(p) == 'cygwin', p
46 assert env['PROGSUFFIX'] == '.exe', env
47 assert env['LIBSUFFIX'] == '.a', env
48 assert env['SHELL'] == 'sh', env
50 p = SCons.Platform.Platform('os2')
51 assert str(p) == 'os2', p
54 assert env['PROGSUFFIX'] == '.exe', env
55 assert env['LIBSUFFIX'] == '.lib', env
57 p = SCons.Platform.Platform('posix')
58 assert str(p) == 'posix', p
61 assert env['PROGSUFFIX'] == '', env
62 assert env['LIBSUFFIX'] == '.a', env
63 assert env['SHELL'] == 'sh', env
65 p = SCons.Platform.Platform('irix')
66 assert str(p) == 'irix', p
69 assert env['PROGSUFFIX'] == '', env
70 assert env['LIBSUFFIX'] == '.a', env
71 assert env['SHELL'] == 'sh', env
73 p = SCons.Platform.Platform('aix')
74 assert str(p) == 'aix', p
77 assert env['PROGSUFFIX'] == '', env
78 assert env['LIBSUFFIX'] == '.a', env
79 assert env['SHELL'] == 'sh', env
81 p = SCons.Platform.Platform('sunos')
82 assert str(p) == 'sunos', p
85 assert env['PROGSUFFIX'] == '', env
86 assert env['LIBSUFFIX'] == '.a', env
87 assert env['SHELL'] == 'sh', env
89 p = SCons.Platform.Platform('hpux')
90 assert str(p) == 'hpux', p
93 assert env['PROGSUFFIX'] == '', env
94 assert env['LIBSUFFIX'] == '.a', env
95 assert env['SHELL'] == 'sh', env
97 p = SCons.Platform.Platform('win32')
98 assert str(p) == 'win32', p
101 assert env['PROGSUFFIX'] == '.exe', env
102 assert env['LIBSUFFIX'] == '.lib', env
106 p = SCons.Platform.Platform('_does_not_exist_')
107 except SCons.Errors.UserError:
113 SCons.Platform.Platform()(env)
114 assert env != {}, env
117 if __name__ == "__main__":
118 suite = unittest.makeSuite(PlatformTestCase, 'test_')
119 if not unittest.TextTestRunner().run(suite).wasSuccessful():
124 # indent-tabs-mode:nil
126 # vim: set expandtab tabstop=4 shiftwidth=4: