# HG changeset patch # User Bryan O'Sullivan # Date 2013-04-29 21:14:41 # Node ID f01ae031f84c41811aa7c1d725236b2d878e2183 # Parent 3f5e75c22585975eaf4ea1c8da71676a88637eec dispatch: add doctests for _earlygetopt diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py --- a/mercurial/dispatch.py +++ b/mercurial/dispatch.py @@ -485,6 +485,18 @@ def _earlygetopt(aliases, args): The values are listed in the order they appear in args. The options and values are removed from args. + + >>> args = ['x', '--cwd', 'foo', 'y'] + >>> _earlygetopt(['--cwd'], args), args + (['foo'], ['x', 'y']) + + >>> args = ['x', '-R', 'foo', 'y'] + >>> _earlygetopt(['-R'], args), args + (['foo'], ['x', 'y']) + + >>> args = ['x', '-Rbar', 'y'] + >>> _earlygetopt(['-R'], args), args + (['bar'], ['x', 'y']) """ try: argcount = args.index("--") diff --git a/tests/test-doctest.py b/tests/test-doctest.py --- a/tests/test-doctest.py +++ b/tests/test-doctest.py @@ -27,6 +27,9 @@ doctest.testmod(mercurial.ui) import mercurial.url doctest.testmod(mercurial.url) +import mercurial.dispatch +doctest.testmod(mercurial.dispatch) + import mercurial.encoding doctest.testmod(mercurial.encoding)