summaryrefslogtreecommitdiff
path: root/test/Default.py
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-03-20 15:18:31 -0700
committerWilliam Deegan <bill@baddogconsulting.com>2017-03-20 15:18:31 -0700
commitd3da4fd3d250662234001baecff23ba69b9e91ad (patch)
tree3778e897f778ac5d483cdef52e627c934a4f8f84 /test/Default.py
parent8ba4d168b797f2b19f15771807e6f578fdaf4e40 (diff)
downloadscons-d3da4fd3d250662234001baecff23ba69b9e91ad.tar.gz
added mode='r' for must_matches, and for one case added mode='w' for source file failing to compile with compiler complaining about mac formatted file
Diffstat (limited to 'test/Default.py')
-rw-r--r--test/Default.py61
1 files changed, 26 insertions, 35 deletions
diff --git a/test/Default.py b/test/Default.py
index e9ca96aa..05944a63 100644
--- a/test/Default.py
+++ b/test/Default.py
@@ -36,13 +36,10 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-for dir in ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight']:
-
- test.subdir(dir)
-
- test.write(os.path.join(dir, 'foo.in'), dir + "/foo.in\n");
-
- test.write(os.path.join(dir, 'bar.in'), dir + "/bar.in\n");
+for dirname in ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight']:
+ test.subdir(dirname)
+ test.write(os.path.join(dirname, 'foo.in'), dirname + "/foo.in\n")
+ test.write(os.path.join(dirname, 'bar.in'), dirname + "/bar.in\n")
test.write('build.py', r"""
import sys
@@ -94,26 +91,24 @@ Default(env.B(target = 'bar.out', source = 'bar.in'))
""" % locals())
-for dir in ['one', 'two', 'three', 'four', 'five']:
+for dirname in ['one', 'two', 'three', 'four', 'five']:
+ test.run(chdir=dirname) # no arguments, use the Default
- test.run(chdir = dir) # no arguments, use the Default
-
-test.must_match(test.workpath('one', 'foo.out'), "one/foo.in\n")
+test.must_match(test.workpath('one', 'foo.out'), "one/foo.in\n", mode='r')
test.fail_test(os.path.exists(test.workpath('one', 'bar')))
-test.must_match(test.workpath('two', 'foo.out'), "two/foo.in\n")
-test.must_match(test.workpath('two', 'bar.out'), "two/bar.in\n")
+test.must_match(test.workpath('two', 'foo.out'), "two/foo.in\n", mode='r')
+test.must_match(test.workpath('two', 'bar.out'), "two/bar.in\n", mode='r')
-test.must_match(test.workpath('three', 'foo.out'), "three/foo.in\n")
-test.must_match(test.workpath('three', 'bar.out'), "three/bar.in\n")
+test.must_match(test.workpath('three', 'foo.out'), "three/foo.in\n", mode='r')
+test.must_match(test.workpath('three', 'bar.out'), "three/bar.in\n", mode='r')
test.fail_test(os.path.exists(test.workpath('four', 'foo')))
test.fail_test(os.path.exists(test.workpath('four', 'bar')))
-test.must_match(test.workpath('four', 'foo bar'), "four/foo.in\n")
-
-test.must_match(test.workpath('five', 'foo.out'), "five/foo.in\n")
-test.must_match(test.workpath('five', 'bar.out'), "five/bar.in\n")
+test.must_match(test.workpath('four', 'foo bar'), "four/foo.in\n", mode='r')
+test.must_match(test.workpath('five', 'foo.out'), "five/foo.in\n", mode='r')
+test.must_match(test.workpath('five', 'bar.out'), "five/bar.in\n", mode='r')
# Test how a None Default() argument works to disable/reset default targets.
@@ -125,8 +120,8 @@ bar = env.B(target = 'bar.out', source = 'bar.in')
Default(None)
""" % locals())
-test.run(chdir = 'six', status = 2, stderr =
-"scons: *** No targets specified and no Default() targets found. Stop.\n")
+test.run(chdir='six', status=2,
+ stderr="scons: *** No targets specified and no Default() targets found. Stop.\n")
test.write(['seven', 'SConstruct'], """\
B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
@@ -136,8 +131,8 @@ bar = env.B(target = 'bar.out', source = 'bar.in')
Default(foo, bar, None)
""" % locals())
-test.run(chdir = 'seven', status = 2, stderr =
-"scons: *** No targets specified and no Default() targets found. Stop.\n")
+test.run(chdir='seven', status=2,
+ stderr="scons: *** No targets specified and no Default() targets found. Stop.\n")
test.write(['eight', 'SConstruct'], """\
B = Builder(action = r'%(_python_)s ../build.py $TARGET $SOURCES')
@@ -147,12 +142,10 @@ bar = env.B(target = 'bar.out', source = 'bar.in')
Default(foo, None, bar)
""" % locals())
-test.run(chdir = 'eight') # no arguments, use the Default
+test.run(chdir='eight') # no arguments, use the Default
test.fail_test(os.path.exists(test.workpath('eight', 'foo.out')))
-test.must_match(test.workpath('eight', 'bar.out'), "eight/bar.in\n")
-
-
+test.must_match(test.workpath('eight', 'bar.out'), "eight/bar.in\n", mode='r')
test.subdir('nine', ['nine', 'sub1'])
@@ -175,11 +168,10 @@ Default('xxx.out')
test.write(['nine', 'sub1', 'xxx.in'], "sub1/xxx.in\n")
-test.run(chdir = 'nine') # no arguments, use the Default
+test.run(chdir='nine') # no arguments, use the Default
test.fail_test(os.path.exists(test.workpath('nine', 'xxx.out')))
-test.must_match(test.workpath('nine', 'sub1', 'xxx.out'), "sub1/xxx.in\n")
-
+test.must_match(test.workpath('nine', 'sub1', 'xxx.out'), "sub1/xxx.in\n", mode='r')
test.subdir('ten', ['ten', 'sub2'])
@@ -202,10 +194,10 @@ env.B(target = 'xxx.out', source = 'xxx.in')
test.write(['ten', 'sub2', 'xxx.in'], "sub2/xxx.in\n")
-test.run(chdir = 'ten') # no arguments, use the Default
+test.run(chdir='ten') # no arguments, use the Default
test.fail_test(os.path.exists(test.workpath('ten', 'xxx.out')))
-test.must_match(test.workpath('ten', 'sub2', 'xxx.out'), "sub2/xxx.in\n")
+test.must_match(test.workpath('ten', 'sub2', 'xxx.out'), "sub2/xxx.in\n", mode='r')
test.subdir('eleven')
@@ -222,13 +214,12 @@ test.write(os.path.join('eleven', 'foo.in'), "eleven/foo.in\n")
test.write(os.path.join('eleven', 'bar.in'), "eleven/bar.in\n")
-test.run(chdir = 'eleven') # no arguments, use the Default
+test.run(chdir='eleven') # no arguments, use the Default
-test.must_match(test.workpath('eleven', 'foo.out'), "eleven/foo.in\n")
+test.must_match(test.workpath('eleven', 'foo.out'), "eleven/foo.in\n", mode='r')
test.fail_test(os.path.exists(test.workpath('eleven', 'bar')))
-
test.pass_test()
# Local Variables: