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
27 Verify that expansion of construction variables whose values are functions
28 (that return lists that contain Nodes, even) works as expected within
29 a $CPPPATH list definition.
31 This used to cause TypeErrors when the _concat expansion tried to
32 join the Nodes with the strings.
34 Test courtesy Konstantin Bozhikov.
39 test
= TestSCons
.TestSCons()
41 test
.subdir('list_inc1',
48 test
.write('SConstruct', """\
49 DefaultEnvironment(tools=[])
50 def my_cpppaths( target, source, env, for_signature ):
51 return [ Dir('list_inc1'), Dir('list_inc2') ]
53 env = Environment( CPPPATH = [Dir('inc1'), '$INC2', '$INC3/subdir', '$MY_CPPPATHS' ],
56 MY_CPPPATHS = my_cpppaths )
61 test
.write('prog.c', """\
64 #include "string_list_1.h"
65 #include "string_list_2.h"
71 main(int argc, char *argv[])
75 printf("%s\\n", STRING_LIST_1);
76 printf("%s\\n", STRING_LIST_2);
77 printf("%s\\n", STRING_1);
78 printf("%s\\n", STRING_2);
79 printf("%s\\n", STRING_3);
84 test
.write(['list_inc1', 'string_list_1.h'], """\
85 #define STRING_LIST_1 "list_inc1/string_list_1.h"
88 test
.write(['list_inc2', 'string_list_2.h'], """\
89 #define STRING_LIST_2 "list_inc2/string_list_2.h"
92 test
.write(['inc1', 'string_1.h'], """\
93 #define STRING_1 "inc1/string_1.h"
96 test
.write(['inc2', 'string_2.h'], """\
97 #define STRING_2 "inc2/string_2.h"
100 test
.write(['inc3', 'subdir', 'string_3.h'], """\
101 #define STRING_3 "inc3/subdir/string_3.h"
106 test
.up_to_date(arguments
= '.')
110 list_inc1/string_list_1.h
111 list_inc2/string_list_2.h
114 inc3/subdir/string_3.h
117 test
.run(program
= test
.workpath('prog' + TestSCons
._exe
), stdout
=expect
)
119 test
.write(['inc3', 'subdir', 'string_3.h'], """\
120 #define STRING_3 "inc3/subdir/string_3.h 2"
123 test
.not_up_to_date(arguments
= '.')
127 list_inc1/string_list_1.h
128 list_inc2/string_list_2.h
131 inc3/subdir/string_3.h 2
134 test
.run(program
= test
.workpath('prog' + TestSCons
._exe
), stdout
=expect
)
140 # indent-tabs-mode:nil
142 # vim: set expandtab tabstop=4 shiftwidth=4: