~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_options.py

  • Committer: Alexander Belchenko
  • Date: 2006-07-30 07:23:36 UTC
  • mto: (1711.2.111 jam-integration)
  • mto: This revision was merged to the branch mainline in revision 1906.
  • Revision ID: bialix@ukr.net-20060730072336-3e9fd7ddb67b5f47
More branding: bazaar-ng -> Bazaar; bazaar-ng.org -> bazaar-vcs.org

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
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"""
13
15
        eq = self.assertEquals
14
16
        eq(parse_args(cmd_commit(), ['--help']),
15
17
           ([], {'help': True}))
16
 
        eq(parse_args(cmd_status(), ['--all']),
17
 
           ([], {'all': True}))
18
18
        eq(parse_args(cmd_commit(), ['--message=biter']),
19
19
           ([], {'message': 'biter'}))
20
20
        ## eq(parse_args(cmd_log(),  '-r 500'.split()),
44
44
 
45
45
    def test_unknown_short_opt(self):
46
46
        out, err = self.run_bzr_captured(['help', '-r'], retcode=3)
47
 
        self.assertContainsRe(err, r'unknown short option')
 
47
        self.assertContainsRe(err, r'unknown option')
 
48
 
 
49
    def test_allow_dash(self):
 
50
        """Test that we can pass a plain '-' as an argument."""
 
51
        self.assertEqual((['-'], {}), parse_args(cmd_commit(), ['-']))
48
52
 
49
53
 
50
54
#     >>> parse_args('log -r 500'.split())