5 # Permission is hereby granted, free of charge, to any person obtaining
6 # a copy of this software and associated documentation files (the
7 # "Software"), to deal in the Software without restriction, including
8 # without limitation the rights to use, copy, modify, merge, publish,
9 # distribute, sublicense, and/or sell copies of the Software, and to
10 # permit persons to whom the Software is furnished to do so, subject to
11 # the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
17 # KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
18 # WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
28 Test the ability to scan additional filesuffixes added to $DSUFFIXES.
33 _python_ = TestSCons._python_
35 test = TestSCons.TestSCons()
37 test.write('mydc.py', r"""
39 def do_file(outf, inf):
40 for line in open(inf, 'rb').readlines():
41 if line[:7] == 'import ':
42 do_file(outf, line[7:-2]+'.d')
45 outf = open(sys.argv[1], 'wb')
46 for f in sys.argv[2:]:
51 test.write('SConstruct', """
52 # Force the 'dmd' tool to get added to the Environment, even if it's not
53 # installed, so we get its definition of variables to deal with turning
54 # '.d' suffix files into objects.
57 # Now replace those suffixes with our fake-D things.
58 env.Replace(DPATH = ['.'],
59 DC = r'%(_python_)s mydc.py',
61 DCOM = '$DC $TARGET $SOURCES',
63 env.Append(CPPSUFFIXES = ['.x'])
64 env.Object(target = 'test1', source = 'test1.d')
65 env.InstallAs('test1_d', 'test1.d')
66 env.InstallAs('test2_d', 'test2.d')
67 env.InstallAs('test3_d', 'test3.d')
70 test.write('test1.d', """\
76 test.write('test2.d', """\
81 test.write('test3.d', """\
86 test.write('foo.d', "foo.d 1\n")
88 expect = test.wrap_stdout("""\
89 %(_python_)s mydc.py test1.o test1.d
90 Install file: "test1.d" as "test1_d"
91 Install file: "test2.d" as "test2_d"
92 Install file: "test3.d" as "test3_d"
95 test.run(arguments='.', stdout=expect)
97 test.must_match('test1.o', """\
105 test.up_to_date(arguments='.')
107 test.write('foo.d', "foo.d 2\n")
109 expect = test.wrap_stdout("""\
110 %(_python_)s mydc.py test1.o test1.d
113 test.run(arguments='.', stdout=expect)
115 test.must_match('test1.o', """\
123 test.up_to_date(arguments='.')
125 test.write('test3.d', """\
130 expect = test.wrap_stdout("""\
131 %(_python_)s mydc.py test1.o test1.d
132 Install file: "test3.d" as "test3_d"
135 test.run(arguments='.', stdout=expect)
137 test.must_match('test1.o', """\
145 test.up_to_date(arguments='.')
147 test.write('test2.d', """\
152 expect = test.wrap_stdout("""\
153 %(_python_)s mydc.py test1.o test1.d
154 Install file: "test2.d" as "test2_d"
157 test.run(arguments='.', stdout=expect)
159 test.must_match('test1.o', """\
167 test.up_to_date(arguments='.')
173 # indent-tabs-mode:nil
175 # vim: set expandtab tabstop=4 shiftwidth=4: