Mercurial > public > mercurial-scm > hg
diff tests/test-help.t @ 37091:979c8ce9022d
fancyopts: fix rendering of customopt defaults in help text
Differential Revision: https://phab.mercurial-scm.org/D2935
author | Daniel Ploch <dploch@google.com> |
---|---|
date | Thu, 22 Mar 2018 17:08:25 -0700 |
parents | efc4fb344c05 |
children | 6890b7e991a4 |
line wrap: on
line diff
--- a/tests/test-help.t Mon Mar 12 18:38:26 2018 +0530 +++ b/tests/test-help.t Thu Mar 22 17:08:25 2018 -0700 @@ -716,15 +716,23 @@ $ cat > helpext.py <<EOF > import os - > from mercurial import commands, registrar + > from mercurial import commands, fancyopts, registrar > + > def func(arg): + > return '%sfoo' % arg + > class customopt(fancyopts.customopt): + > def newstate(self, oldstate, newparam, abort): + > return '%sbar' % oldstate > cmdtable = {} > command = registrar.command(cmdtable) > > @command(b'nohelp', - > [(b'', b'longdesc', 3, b'x'*90), + > [(b'', b'longdesc', 3, b'x'*67), > (b'n', b'', None, b'normal desc'), - > (b'', b'newline', b'', b'line1\nline2')], + > (b'', b'newline', b'', b'line1\nline2'), + > (b'', b'callableopt', func, b'adds foo'), + > (b'', b'customopt', customopt(''), b'adds bar'), + > (b'', b'customopt-withdefault', customopt('foo'), b'adds bar')], > b'hg nohelp', > norepo=True) > @command(b'debugoptADV', [(b'', b'aopt', None, b'option is (ADVANCED)')]) @@ -786,10 +794,14 @@ options: - --longdesc VALUE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (default: 3) - -n -- normal desc - --newline VALUE line1 line2 + --longdesc VALUE + xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + xxxxxxxxxxxxxxxxxxxxxxx (default: 3) + -n -- normal desc + --newline VALUE line1 line2 + --callableopt VALUE adds foo + --customopt VALUE adds bar + --customopt-withdefault VALUE adds bar (default: foo) (some details hidden, use --verbose to show complete help)