~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_options.py

  • Committer: Jonathan Lange
  • Date: 2007-04-13 03:52:48 UTC
  • mto: This revision was merged to the branch mainline in revision 2446.
  • Revision ID: jml@canonical.com-20070413035248-l5lqpwr1t0yzp872
Provide a way of resetting list options (specifying '-' as the argument)

Show diffs side-by-side

added added

removed removed

Lines of Context:
242
242
#     (['log'], {'revision': [<RevisionSpec_revno revno:500>, <RevisionSpec_int 600>]})
243
243
 
244
244
 
245
 
class ListOptions(TestCase):
 
245
class TestListOptions(TestCase):
 
246
    """Tests for ListOption, used to specify lists on the command-line."""
 
247
 
246
248
    def parse(self, options, args):
247
249
        parser = option.get_optparser(dict((o.name, o) for o in options))
248
250
        return parser.parse_args(args)
256
258
        options = [option.ListOption('hello', type=str)]
257
259
        opts, args = self.parse(options, [])
258
260
        self.assertEqual([], opts.hello)
 
261
 
 
262
    def test_list_option_can_be_reset(self):
 
263
        """Passing an option of '-' to a list option should reset the list."""
 
264
        options = [option.ListOption('hello', type=str)]
 
265
        opts, args = self.parse(
 
266
            options, ['--hello=a', '--hello=b', '--hello=-', '--hello=c'])
 
267
        self.assertEqual(['c'], opts.hello)