~bzr-pqm/bzr/bzr.dev

1553.4.3 by Michael Ellerman
Add custom description for help's --long option, this fixes bug #31217.
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)