changeset 19098:f01ae031f84c stable

dispatch: add doctests for _earlygetopt
author Bryan O'Sullivan <bryano@fb.com>
date Mon, 29 Apr 2013 14:14:41 -0700
parents 3f5e75c22585
children fc081623f4bd
files mercurial/dispatch.py tests/test-doctest.py
diffstat 2 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dispatch.py	Tue Apr 30 21:19:56 2013 +0200
+++ b/mercurial/dispatch.py	Mon Apr 29 14:14:41 2013 -0700
@@ -485,6 +485,18 @@
 
     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("--")
--- a/tests/test-doctest.py	Tue Apr 30 21:19:56 2013 +0200
+++ b/tests/test-doctest.py	Mon Apr 29 14:14:41 2013 -0700
@@ -27,6 +27,9 @@
 import mercurial.url
 doctest.testmod(mercurial.url)
 
+import mercurial.dispatch
+doctest.testmod(mercurial.dispatch)
+
 import mercurial.encoding
 doctest.testmod(mercurial.encoding)