~ubuntu-branches/ubuntu/lucid/bzr/lucid-proposed

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_help.py

  • Committer: Bazaar Package Importer
  • Author(s): Jeff Bailey
  • Date: 2006-03-20 08:31:00 UTC
  • mfrom: (1.1.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20060320083100-ovdi2ssuw0epcx8s
Tags: 0.8~200603200831-0ubuntu1
* Snapshot uploaded to Dapper at Martin Pool's request.

* Disable testsuite for upload.  Fakeroot and the testsuite don't
  play along.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2005 by Canonical Ltd
 
2
# -*- coding: utf-8 -*-
 
3
 
 
4
# This program is free software; you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation; either version 2 of the License, or
 
7
# (at your option) any later version.
 
8
 
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
# GNU General Public License for more details.
 
13
 
 
14
# You should have received a copy of the GNU General Public License
 
15
# along with this program; if not, write to the Free Software
 
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
 
 
18
 
 
19
"""Black-box tests for bzr help.
 
20
"""
 
21
 
 
22
 
 
23
from bzrlib.tests.blackbox import ExternalBase
 
24
 
 
25
 
 
26
class TestHelp(ExternalBase):
 
27
 
 
28
    def test_help_basic(self):
 
29
        dash_help = self.runbzr('--help')[0]
 
30
        just_help = self.runbzr('help')[0]
 
31
        quest_mk  = self.runbzr('?')[0]
 
32
        self.assertEquals(dash_help, just_help)
 
33
        self.assertEquals(dash_help, quest_mk)
 
34
 
 
35
    def test_help_commands(self):
 
36
        dash_help  = self.runbzr('--help commands')[0]
 
37
        commands   = self.runbzr('help commands')[0]
 
38
        long_help  = self.runbzr('help --long')[0]
 
39
        qmark_long = self.runbzr('? --long')[0]
 
40
        qmark_cmds = self.runbzr('? commands')[0]
 
41
        self.assertEquals(dash_help, commands)
 
42
        self.assertEquals(dash_help, long_help)
 
43
        self.assertEquals(dash_help, qmark_long)
 
44
        self.assertEquals(dash_help, qmark_cmds)
 
45
 
 
46
    def test_help_detail(self):
 
47
        dash_h  = self.runbzr('commit -h')[0]
 
48
        help_x  = self.runbzr('help commit')[0]
 
49
        qmark_x = self.runbzr('help commit')[0]
 
50
        self.assertEquals(dash_h, help_x)
 
51
        self.assertEquals(dash_h, qmark_x)
 
52
 
 
53
    def test_help_help(self):
 
54
        help = self.runbzr('help help')[0]
 
55
        qmark = self.runbzr('? ?')[0]
 
56
        self.assertEquals(help, qmark)
 
57
        for line in help.split('\n'):
 
58
            if '--long' in line:
 
59
                self.assertTrue('show help on all commands' in line)