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__"
32 def match_normcase(lines, matches):
33 if not type(lines) is types.ListType:
34 lines = lines.split("\n")
35 if not type(matches) is types.ListType:
36 matches = matches.split("\n")
37 if len(lines) != len(matches):
39 for i in range(len(lines)):
40 if os.path.normcase(lines[i]) != os.path.normcase(matches[i]):
44 test = TestSCons.TestSCons(match=match_normcase)
46 wpath = test.workpath()
47 wpath_sub = test.workpath('sub')
48 wpath_sub_dir = test.workpath('sub', 'dir')
49 wpath_sub_foo_bar = test.workpath('sub', 'foo', 'bar')
51 test.subdir('sub', ['sub', 'dir'])
53 test.write('SConstruct', """
55 print "SConstruct", os.getcwd()
58 test.write(['sub', 'SConstruct'], """
60 print GetBuildPath('..')
63 test.write(['sub', 'dir', 'SConstruct'], """
65 env = Environment(FOO='foo', BAR='bar')
66 print env.GetBuildPath('../$FOO/$BAR')
69 test.run(arguments = '-C sub .',
70 stdout = "scons: Entering directory `%s'\n" % wpath_sub \
71 + test.wrap_stdout(read_str = '%s\n' % wpath,
72 build_str = "scons: `.' is up to date.\n"))
74 test.run(arguments = '-C sub -C dir .',
75 stdout = "scons: Entering directory `%s'\n" % wpath_sub_dir \
76 + test.wrap_stdout(read_str = '%s\n' % wpath_sub_foo_bar,
77 build_str = "scons: `.' is up to date.\n"))
79 test.run(arguments = ".",
80 stdout = test.wrap_stdout(read_str = 'SConstruct %s\n' % wpath,
81 build_str = "scons: `.' is up to date.\n"))
83 test.run(arguments = '--directory=sub/dir .',
84 stdout = "scons: Entering directory `%s'\n" % wpath_sub_dir \
85 + test.wrap_stdout(read_str = '%s\n' % wpath_sub_foo_bar,
86 build_str = "scons: `.' is up to date.\n"))
88 test.run(arguments = '-C %s -C %s .' % (wpath_sub_dir, wpath_sub),
89 stdout = "scons: Entering directory `%s'\n" % wpath_sub \
90 + test.wrap_stdout(read_str = '%s\n' % wpath,
91 build_str = "scons: `.' is up to date.\n"))
97 # indent-tabs-mode:nil
99 # vim: set expandtab tabstop=4 shiftwidth=4: