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__"
30 import SCons.Node.Alias
32 class AliasTestCase(unittest.TestCase):
34 def test_AliasNameSpace(self):
35 """Test creating an Alias name space
37 ans = SCons.Node.Alias.AliasNameSpace()
38 assert not ans is None, ans
40 def test_ANS_Alias(self):
41 """Test the Alias() factory
43 ans = SCons.Node.Alias.AliasNameSpace()
46 assert a1.name == 'a1', a1.name
49 assert a1 is a2, (a1, a2)
51 def test_get_contents(self):
52 """Test the get_contents() method
55 def __init__(self, contents):
56 self.contents = contents
59 def get_contents(self):
62 ans = SCons.Node.Alias.AliasNameSpace()
67 a.sources = [ DummyNode('one'), DummyNode('two'), DummyNode('three') ]
70 assert c == 'onetwothree', c
72 def test_lookup(self):
73 """Test the lookup() method
75 ans = SCons.Node.Alias.AliasNameSpace()
79 assert a.name == 'a1', a.name
88 """Test creating an Alias() object
90 a1 = SCons.Node.Alias.Alias('a')
91 assert a1.name == 'a', a1.name
93 a2 = SCons.Node.Alias.Alias('a')
94 assert a2.name == 'a', a2.name
97 assert a1.name == a2.name
99 class AliasNodeInfoTestCase(unittest.TestCase):
100 def test___init__(self):
101 """Test AliasNodeInfo initialization"""
102 ans = SCons.Node.Alias.AliasNameSpace()
103 aaa = ans.Alias('aaa')
104 ni = SCons.Node.Alias.AliasNodeInfo(aaa)
106 class AliasBuildInfoTestCase(unittest.TestCase):
107 def test___init__(self):
108 """Test AliasBuildInfo initialization"""
109 ans = SCons.Node.Alias.AliasNameSpace()
110 aaa = ans.Alias('aaa')
111 bi = SCons.Node.Alias.AliasBuildInfo(aaa)
113 if __name__ == "__main__":
114 suite = unittest.TestSuite()
117 AliasBuildInfoTestCase,
118 AliasNodeInfoTestCase,
120 for tclass in tclasses:
121 names = unittest.getTestCaseNames(tclass, 'test_')
122 suite.addTests(map(tclass, names))
123 if not unittest.TextTestRunner().run(suite).wasSuccessful():
128 # indent-tabs-mode:nil
130 # vim: set expandtab tabstop=4 shiftwidth=4: