summaryrefslogtreecommitdiffstats
path: root/test/option--warn.py
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-04-06 16:17:34 (GMT)
committerSteven Knight <knight@baldmt.com>2004-04-06 16:17:34 (GMT)
commitce5403ae95d90fa06a507b1878206a312b125edb (patch)
tree519c1dc00835c3eef340400099da50c0328b76ff /test/option--warn.py
parente69debfd6d48ed158699ba814c1c23459e121a20 (diff)
downloadSCons-ce5403ae95d90fa06a507b1878206a312b125edb.zip
SCons-ce5403ae95d90fa06a507b1878206a312b125edb.tar.gz
SCons-ce5403ae95d90fa06a507b1878206a312b125edb.tar.bz2
Add warnings for easily-confused variable names like 'targets' and 'sources.'
Diffstat (limited to 'test/option--warn.py')
-rw-r--r--test/option--warn.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/test/option--warn.py b/test/option--warn.py
index ac510bc..0bf9a7e 100644
--- a/test/option--warn.py
+++ b/test/option--warn.py
@@ -140,4 +140,44 @@ File "SConstruct", line \d+, in .+
test.run(arguments='--warn=no-duplicate-environment file1.out')
+
+test.write('SConstruct', """
+def build(env, target, source):
+ file = open(str(target[0]), 'wb')
+ for s in source:
+ file.write(open(str(s), 'rb').read())
+
+B = Builder(action=build, multi=1)
+env = Environment(BUILDERS = { 'B' : B })
+env.B(targets = 'file3a.out', source = 'file3a.in')
+env.B(target = 'file3b.out', sources = 'file3b.in')
+""")
+
+test.write('file3a.in', 'file3a.in\n')
+test.write('file3b.out', 'file3b.out\n')
+
+test.run(arguments='.',
+ stderr=r"""
+scons: warning: Did you mean to use `target' instead of `targets'\?
+File "SConstruct", line \d+, in .+
+
+scons: warning: Did you mean to use `source' instead of `sources'\?
+File "SConstruct", line \d+, in .+
+""")
+
+test.must_match(['file3a'], 'file3a.in\n')
+test.must_match(['file3b'], 'file3b.out\n')
+
+test.run(arguments='--warn=misleading-keywords .',
+ stderr=r"""
+scons: warning: Did you mean to use `target' instead of `targets'\?
+File "SConstruct", line \d+, in .+
+
+scons: warning: Did you mean to use `source' instead of `sources'\?
+File "SConstruct", line \d+, in .+
+""")
+
+test.run(arguments='--warn=no-misleading-keywords .')
+
+
test.pass_test()