From 568520b7af2d9f07c3c604dc0e9a451e56b29fa4 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Tue, 15 Dec 2009 06:35:05 +0000 Subject: [PATCH] Add a TestSCons.option_not_yet_implemented() method and use it so the tests of those options expect an exit status of 1. git-svn-id: http://scons.tigris.org/svn/scons/trunk@4547 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- QMTest/TestSCons.py | 19 +++++++++++++++++++ test/option--R.py | 7 ++----- test/option--W.py | 13 ++++--------- test/option--la.py | 4 +--- test/option--ld.py | 4 +--- test/option--lw.py | 4 +--- test/option--override.py | 4 +--- test/option--wf.py | 4 +--- test/option--wuv.py | 4 +--- test/option-l.py | 10 +++------- test/option-o.py | 10 +++------- test/option-p.py | 4 +--- test/option-r.py | 7 ++----- 13 files changed, 40 insertions(+), 54 deletions(-) diff --git a/QMTest/TestSCons.py b/QMTest/TestSCons.py index f73de041..e698f4ea 100644 --- a/QMTest/TestSCons.py +++ b/QMTest/TestSCons.py @@ -412,6 +412,25 @@ class TestSCons(TestCommon): kw['match'] = self.match_re_dotall apply(self.run, [], kw) + def option_not_yet_implemented(self, option, arguments=None, **kw): + """ + Verifies expected behavior for options that are not yet implemented: + a warning message, and exit status 1. + """ + msg = "Warning: the %s option is not yet implemented\n" % option + kw['stderr'] = msg + kw['status'] = 1 + if arguments: + # If it's a long option and the argument string begins with '=', + # it's of the form --foo=bar and needs no separating space. + if option[:2] == '--' and arguments[0] == '=': + kw['arguments'] = option + arguments + else: + kw['arguments'] = option + ' ' + arguments + # TODO(1.5) + #return self.run(**kw) + return apply(self.run, (), kw) + def diff_substr(self, expect, actual, prelen=20, postlen=40): i = 0 for x, y in zip(expect, actual): diff --git a/test/option--R.py b/test/option--R.py index 5fecc670..3b66e288 100644 --- a/test/option--R.py +++ b/test/option--R.py @@ -30,14 +30,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-R .', - stderr = "Warning: the -R option is not yet implemented\n") +test.option_not_yet_implemented('-R', '.') -test.run(arguments = '--no-builtin-variables .', - stderr = "Warning: the --no-builtin-variables option is not yet implemented\n") +test.option_not_yet_implemented('--no-builtin-variables', '.') test.pass_test() - # Local Variables: # tab-width:4 diff --git a/test/option--W.py b/test/option--W.py index 9f6fbe49..e29cd7cd 100644 --- a/test/option--W.py +++ b/test/option--W.py @@ -30,21 +30,16 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-W foo .', - stderr = "Warning: the -W option is not yet implemented\n") +test.option_not_yet_implemented('-W', 'foo .') -test.run(arguments = '--what-if=foo .', - stderr = "Warning: the --what-if option is not yet implemented\n") +test.option_not_yet_implemented('--what-if', '=foo .') -test.run(arguments = '--new-file=foo .', - stderr = "Warning: the --new-file option is not yet implemented\n") +test.option_not_yet_implemented('--new-file', '=foo .') -test.run(arguments = '--assume-new=foo .', - stderr = "Warning: the --assume-new option is not yet implemented\n") +test.option_not_yet_implemented('--assume-new', '=foo .') test.pass_test() - # Local Variables: # tab-width:4 # indent-tabs-mode:nil diff --git a/test/option--la.py b/test/option--la.py index ce3aed4a..8a264aab 100644 --- a/test/option--la.py +++ b/test/option--la.py @@ -30,11 +30,9 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--list-actions .', - stderr = "Warning: the --list-actions option is not yet implemented\n") +test.option_not_yet_implemented('--list-actions', '.') test.pass_test() - # Local Variables: # tab-width:4 diff --git a/test/option--ld.py b/test/option--ld.py index 2145de59..90c93460 100644 --- a/test/option--ld.py +++ b/test/option--ld.py @@ -30,11 +30,9 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--list-derived .', - stderr = "Warning: the --list-derived option is not yet implemented\n") +test.option_not_yet_implemented('--list-derived', '.') test.pass_test() - # Local Variables: # tab-width:4 diff --git a/test/option--lw.py b/test/option--lw.py index cafcb57f..f0f5e786 100644 --- a/test/option--lw.py +++ b/test/option--lw.py @@ -30,11 +30,9 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--list-where .', - stderr = "Warning: the --list-where option is not yet implemented\n") +test.option_not_yet_implemented('--list-where', '.') test.pass_test() - # Local Variables: # tab-width:4 diff --git a/test/option--override.py b/test/option--override.py index 42a92ada..7d81fb17 100644 --- a/test/option--override.py +++ b/test/option--override.py @@ -30,11 +30,9 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--override=foo .', - stderr = "Warning: the --override option is not yet implemented\n") +test.option_not_yet_implemented('--override', '=foo .') test.pass_test() - # Local Variables: # tab-width:4 diff --git a/test/option--wf.py b/test/option--wf.py index 7e8cfa7f..79824f30 100644 --- a/test/option--wf.py +++ b/test/option--wf.py @@ -30,11 +30,9 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '--write-filenames=FILE .', - stderr = "Warning: the --write-filenames option is not yet implemented\n") +test.option_not_yet_implemented('--write-filenames', '=FILE .') test.pass_test() - # Local Variables: # tab-width:4 diff --git a/test/option--wuv.py b/test/option--wuv.py index b08567f6..c6845289 100644 --- a/test/option--wuv.py +++ b/test/option--wuv.py @@ -38,11 +38,9 @@ test.pass_test() #XXX Short-circuit until then. test.write('SConstruct', "") -test.run(arguments = '--warn-undefined-variables', - stderr = "Warning: the --warn-undefined-variables option is not yet implemented\n") +test.option_not_yet_implemented('--warn-undefined-variables') test.pass_test() - # Local Variables: # tab-width:4 diff --git a/test/option-l.py b/test/option-l.py index eedb01e7..af308af7 100644 --- a/test/option-l.py +++ b/test/option-l.py @@ -30,17 +30,13 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-l 1 .', - stderr = "Warning: the -l option is not yet implemented\n") +test.option_not_yet_implemented('-l', '1 .') -test.run(arguments = '--load-average=1 .', - stderr = "Warning: the --load-average option is not yet implemented\n") +test.option_not_yet_implemented('--load-average', '=1 .') -test.run(arguments = '--max-load=1 .', - stderr = "Warning: the --max-load option is not yet implemented\n") +test.option_not_yet_implemented('--max-load', '=1 .') test.pass_test() - # Local Variables: # tab-width:4 diff --git a/test/option-o.py b/test/option-o.py index 23f102b8..bde8e8f4 100644 --- a/test/option-o.py +++ b/test/option-o.py @@ -30,17 +30,13 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-o foo .', - stderr = "Warning: the -o option is not yet implemented\n") +test.option_not_yet_implemented('-o', 'foo .') -test.run(arguments = '--old-file=foo .', - stderr = "Warning: the --old-file option is not yet implemented\n") +test.option_not_yet_implemented('--old-file', '=foo .') -test.run(arguments = '--assume-old=foo .', - stderr = "Warning: the --assume-old option is not yet implemented\n") +test.option_not_yet_implemented('--assume-old', '=foo .') test.pass_test() - # Local Variables: # tab-width:4 diff --git a/test/option-p.py b/test/option-p.py index c4c5d753..11390ab2 100644 --- a/test/option-p.py +++ b/test/option-p.py @@ -30,11 +30,9 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-p .', - stderr = "Warning: the -p option is not yet implemented\n") +test.option_not_yet_implemented('-p', '.') test.pass_test() - # Local Variables: # tab-width:4 diff --git a/test/option-r.py b/test/option-r.py index 0c124d12..a3c3911d 100644 --- a/test/option-r.py +++ b/test/option-r.py @@ -30,14 +30,11 @@ test = TestSCons.TestSCons() test.write('SConstruct', "") -test.run(arguments = '-r .', - stderr = "Warning: the -r option is not yet implemented\n") +test.option_not_yet_implemented('-r', '.') -test.run(arguments = '--no-builtin-rules .', - stderr = "Warning: the --no-builtin-rules option is not yet implemented\n") +test.option_not_yet_implemented('--no-builtin-rules', '.') test.pass_test() - # Local Variables: # tab-width:4 -- 2.26.2