~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_help.py

  • Committer: Robert Collins
  • Date: 2007-04-20 03:54:06 UTC
  • mto: This revision was merged to the branch mainline in revision 2441.
  • Revision ID: robertc@robertcollins.net-20070420035406-e68xf089otkpo7xx
Teach Command.get_help_text to show additional help cross references when supplied.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        helptext = cmd.get_help_text()
52
52
        self.assertStartsWith(helptext, 'usage:bzr Demo')
53
53
        self.assertEndsWith(helptext, 'show help message\n')
 
54
 
 
55
    def test_command_with_additional_see_also(self):
 
56
        class cmd_WithSeeAlso(commands.Command):
 
57
            """A sample command."""
 
58
            _see_also = ['foo', 'bar']
 
59
        cmd = cmd_WithSeeAlso()
 
60
        helptext = cmd.get_help_text(['gam'])
 
61
        self.assertEndsWith(
 
62
            helptext,
 
63
            '  -h, --help  show help message\n'
 
64
            '\n'
 
65
            'See also: bar, foo, gam\n')
 
66
 
 
67
    def test_command_only_additional_see_also(self):
 
68
        class cmd_WithSeeAlso(commands.Command):
 
69
            """A sample command."""
 
70
        cmd = cmd_WithSeeAlso()
 
71
        helptext = cmd.get_help_text(['gam'])
 
72
        self.assertEndsWith(
 
73
            helptext,
 
74
            '  -h, --help  show help message\n'
 
75
            '\n'
 
76
            'See also: gam\n')
54
77
    
55
78
 
56
79
class TestRegisteredTopic(tests.TestCase):