added release.txt blurb. Fixed spelling typo in Defaults.xml
[scons.git] / test / Pseudo.py
blobec953f7b2a16f346f6c4b674fc2d355ae001aad3
1 #!/usr/bin/env python
3 # MIT License
5 # Copyright The SCons Foundation
7 # Permission is hereby granted, free of charge, to any person obtaining
8 # a copy of this software and associated documentation files (the
9 # "Software"), to deal in the Software without restriction, including
10 # without limitation the rights to use, copy, modify, merge, publish,
11 # distribute, sublicense, and/or sell copies of the Software, and to
12 # permit persons to whom the Software is furnished to do so, subject to
13 # the following conditions:
15 # The above copyright notice and this permission notice shall be included
16 # in all copies or substantial portions of the Software.
18 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
19 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
22 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
23 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
24 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 """
27 Test the Pseudo method
28 """
30 import TestSCons
32 test = TestSCons.TestSCons()
34 test.write('SConstruct', """\
35 env = Environment()
36 foo = env.Command('foo.out', [], '@echo boo')
37 bar = env.Command('bar.out', [], Touch('$TARGET'))
38 env.Pseudo(foo, bar)
40 gfoo = Command('foo.glb', [], '@echo boo')
41 gbar = Command('bar.glb', [], Touch('$TARGET'))
42 Pseudo(gfoo, gbar)
43 """)
45 # foo.out build does not create file, should generate no errors
46 test.run(arguments='-Q foo.out', stdout='boo\n')
47 # missing target warning triggers if requested
48 test.run(arguments='-Q foo.out --warning=target-not-built', stdout="boo\n")
49 # bar.out build creates file, error if it exists after the build
50 test.run(arguments='-Q bar.out', stdout='Touch("bar.out")\n', stderr=None, status=2)
51 test.must_contain_all_lines(
52 test.stderr(),
53 'scons: *** Pseudo target bar.out must not exist',
55 # warning must not appear since target created
56 test.run(
57 arguments='-Q bar.out --warning=target-not-built',
58 stdout='Touch("bar.out")\n',
59 stderr=None,
60 status=2,
62 test.must_contain_all_lines(
63 test.stderr(),
64 'scons: *** Pseudo target bar.out must not exist',
67 # repeat the process for the global function form (was missing initially)
68 test.run(arguments='-Q foo.glb', stdout='boo\n')
69 test.run(arguments='-Q foo.glb --warning=target-not-built', stdout="boo\n")
70 test.run(arguments='-Q bar.glb', stdout='Touch("bar.glb")\n', stderr=None, status=2)
71 test.must_contain_all_lines(
72 test.stderr(),
73 'scons: *** Pseudo target bar.glb must not exist',
75 test.run(
76 arguments='-Q bar.glb --warning=target-not-built',
77 stdout='Touch("bar.glb")\n',
78 stderr=None,
79 status=2,
81 test.must_contain_all_lines(
82 test.stderr(),
83 'scons: *** Pseudo target bar.glb must not exist',
86 test.pass_test()
88 # Local Variables:
89 # tab-width:4
90 # indent-tabs-mode:nil
91 # End:
92 # vim: set expandtab tabstop=4 shiftwidth=4: