Commits

Anonymous committed afa7c14

Add a TestSCons.option_not_yet_implemented() method and use it so
the tests of those options expect an exit status of 1.

  • Participants
  • Parent commits b98befc

Comments (0)

Files changed (13)

QMTest/TestSCons.py

         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):

test/option--R.py

 
 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

test/option--W.py

 
 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

test/option--la.py

 
 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

test/option--ld.py

 
 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

test/option--lw.py

 
 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

test/option--override.py

 
 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

test/option--wf.py

 
 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

test/option--wuv.py

 
 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
 
 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
 
 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
 
 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
 
 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