~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_options.py

Late bind to PatienceSequenceMatcher to allow plugin to override.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# (C) 2005 Canonical
 
1
# Copyright (C) 2005, 2006 Canonical Ltd
2
2
 
3
 
from bzrlib.selftest import TestCase
 
3
from bzrlib.tests 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.
7
9
 
8
10
class OptionTests(TestCase):
9
11
    """Command-line option tests"""
29
31
        """Options have help strings."""
30
32
        out, err = self.run_bzr_captured(['commit', '--help'])
31
33
        self.assertContainsRe(out, r'--file.*file containing commit message')
 
34
        self.assertContainsRe(out, r'--help.*-h')
32
35
 
33
36
    def test_option_help_global(self):
34
37
        """Global options have help strings."""
41
44
        self.assertEquals(err, '')
42
45
        self.assertContainsRe(out, r'--file[ =]MSGFILE')
43
46
 
 
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
 
44
51
 
45
52
#     >>> parse_args('log -r 500'.split())
46
53
#     (['log'], {'revision': [<RevisionSpec_int 500>]})