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__"
31 def match_normcase(lines, matches):
32 if not isinstance(lines, list):
33 lines = lines.split("\n")
34 if not isinstance(matches, list):
35 matches = matches.split("\n")
36 if len(lines) != len(matches):
38 for i in range(len(lines)):
39 if os.path.normcase(lines[i]) != os.path.normcase(matches[i]):
43 test = TestSCons.TestSCons(match=match_normcase)
45 wpath = test.workpath()
46 wpath_sub = test.workpath('sub')
47 wpath_sub_dir = test.workpath('sub', 'dir')
48 wpath_sub_foo_bar = test.workpath('sub', 'foo', 'bar')
50 test.subdir('sub', ['sub', 'dir'])
52 test.write('SConstruct', """
54 print "SConstruct", os.getcwd()
57 test.write(['sub', 'SConstruct'], """
59 print GetBuildPath('..')
62 test.write(['sub', 'dir', 'SConstruct'], """
64 env = Environment(FOO='foo', BAR='bar')
65 print env.GetBuildPath('../$FOO/$BAR')
68 test.run(arguments = '-C sub .',
69 stdout = "scons: Entering directory `%s'\n" % wpath_sub \
70 + test.wrap_stdout(read_str = '%s\n' % wpath,
71 build_str = "scons: `.' is up to date.\n"))
73 test.run(arguments = '-C sub -C dir .',
74 stdout = "scons: Entering directory `%s'\n" % wpath_sub_dir \
75 + test.wrap_stdout(read_str = '%s\n' % wpath_sub_foo_bar,
76 build_str = "scons: `.' is up to date.\n"))
78 test.run(arguments = ".",
79 stdout = test.wrap_stdout(read_str = 'SConstruct %s\n' % wpath,
80 build_str = "scons: `.' is up to date.\n"))
82 test.run(arguments = '--directory=sub/dir .',
83 stdout = "scons: Entering directory `%s'\n" % wpath_sub_dir \
84 + test.wrap_stdout(read_str = '%s\n' % wpath_sub_foo_bar,
85 build_str = "scons: `.' is up to date.\n"))
87 test.run(arguments = '-C %s -C %s .' % (wpath_sub_dir, wpath_sub),
88 stdout = "scons: Entering directory `%s'\n" % wpath_sub \
89 + test.wrap_stdout(read_str = '%s\n' % wpath,
90 build_str = "scons: `.' is up to date.\n"))
96 # indent-tabs-mode:nil
98 # vim: set expandtab tabstop=4 shiftwidth=4: