~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_options.py

(gz) Include registry option value switches in help style checking test
 (Martin Packman)

Show diffs side-by-side

added added

removed removed

Lines of Context:
352
352
    def test_option_grammar(self):
353
353
        msgs = []
354
354
        # Option help should be written in sentence form, and have a final
355
 
        # period and be all on a single line, because the display code will
356
 
        # wrap it.
357
 
        option_re = re.compile(r'^[A-Z][^\n]+\.$')
 
355
        # period with an optional bracketed suffix. All the text should be on
 
356
        # one line, because the display code will wrap it.
 
357
        option_re = re.compile(r'^[A-Z][^\n]+\.(?: \([^\n]+\))?$')
358
358
        for scope, opt in self.get_builtin_command_options():
359
 
            if not opt.help:
360
 
                msgs.append('%-16s %-16s %s' %
361
 
                       ((scope or 'GLOBAL'), opt.name, 'NO HELP'))
362
 
            elif not option_re.match(opt.help):
363
 
                msgs.append('%-16s %-16s %s' %
364
 
                        ((scope or 'GLOBAL'), opt.name, opt.help))
 
359
            for name, _, _, helptxt in opt.iter_switches():
 
360
                if name != opt.name:
 
361
                    name = "/".join([opt.name, name])
 
362
                if not helptxt:
 
363
                    msgs.append('%-16s %-16s %s' %
 
364
                           ((scope or 'GLOBAL'), name, 'NO HELP'))
 
365
                elif not option_re.match(helptxt):
 
366
                    if name.startswith("format/"):
 
367
                        # Don't complain about the odd format registry help
 
368
                        continue
 
369
                    msgs.append('%-16s %-16s %s' %
 
370
                            ((scope or 'GLOBAL'), name, helptxt))
365
371
        if msgs:
366
372
            self.fail("The following options don't match the style guide:\n"
367
373
                    + '\n'.join(msgs))