diff options
author | Steven Knight <knight@baldmt.com> | 2004-04-06 16:17:34 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2004-04-06 16:17:34 (GMT) |
commit | ce5403ae95d90fa06a507b1878206a312b125edb (patch) | |
tree | 519c1dc00835c3eef340400099da50c0328b76ff /test | |
parent | e69debfd6d48ed158699ba814c1c23459e121a20 (diff) | |
download | SCons-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')
-rw-r--r-- | test/option--warn.py | 40 | ||||
-rw-r--r-- | test/overrides.py | 37 |
2 files changed, 77 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() diff --git a/test/overrides.py b/test/overrides.py index a247f7d..eb43ced 100644 --- a/test/overrides.py +++ b/test/overrides.py @@ -92,4 +92,41 @@ assert test.read('hello.not_exe') == 'this is not a program!' test.up_to_date(arguments='hello.not_exe') + + +test.write('SConstruct', """\ +env = Environment() +env.Program('goodbye', 'goodbye.c', + CC=r'%s mycc.py', + LINK=r'%s mylink.py', + OBJSUFFIX='.not_obj', + PROGSUFFIX='.not_exe', + targets='ttt', + sources='sss') +""" % (python, python)) + +test.write('goodbye.c',"this ain't no c file!\n") + +test.write('mycc.py',""" +open('goodbye.not_obj', 'wt').write('this is no object file!') +""") + +test.write('mylink.py',""" +open('goodbye.not_exe', 'wt').write('this is not a program!') +""") + +test.run(arguments='goodbye.not_exe', stderr="""\ + +scons: warning: Did you mean to use `target' instead of `targets'? +File "SConstruct", line 8, in ? + +scons: warning: Did you mean to use `source' instead of `sources'? +File "SConstruct", line 8, in ? +""") + +assert test.read('goodbye.not_obj') == 'this is no object file!' +assert test.read('goodbye.not_exe') == 'this is not a program!' + + + test.pass_test() |