~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/selftest/testoptions.py

- rules for using destructors

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005, 2006 Canonical Ltd
 
1
# (C) 2005 Canonical
2
2
 
3
 
from bzrlib.tests import TestCase
 
3
from bzrlib.selftest import TestCase
4
4
from bzrlib.commands import Command, parse_args
5
5
from bzrlib.builtins import cmd_commit, cmd_log, cmd_status
6
6
 
7
 
# TODO: might be nice to just parse them into a structured form and test
8
 
# against that, rather than running the whole command.
9
7
 
10
8
class OptionTests(TestCase):
11
9
    """Command-line option tests"""
31
29
        """Options have help strings."""
32
30
        out, err = self.run_bzr_captured(['commit', '--help'])
33
31
        self.assertContainsRe(out, r'--file.*file containing commit message')
34
 
        self.assertContainsRe(out, r'--help.*-h')
35
32
 
36
33
    def test_option_help_global(self):
37
34
        """Global options have help strings."""
44
41
        self.assertEquals(err, '')
45
42
        self.assertContainsRe(out, r'--file[ =]MSGFILE')
46
43
 
47
 
    def test_unknown_short_opt(self):
48
 
        out, err = self.run_bzr_captured(['help', '-r'], retcode=3)
49
 
        self.assertContainsRe(err, r'unknown short option')
50
 
 
51
44
 
52
45
#     >>> parse_args('log -r 500'.split())
53
46
#     (['log'], {'revision': [<RevisionSpec_int 500>]})