[prev in list] [next in list] [prev in thread] [next in thread]
List: mercurial-devel
Subject: [PATCH 1 of 2 stable] dispatch: add doctests for _earlygetopt
From: Bryan O'Sullivan <bos () serpentine ! com>
Date: 2013-04-29 21:15:00
Message-ID: 1050604e2c9d34112d3f.1367270100 () australite ! local
[Download RAW message or body]
# HG changeset patch
# User Bryan O'Sullivan <bryano@fb.com>
# Date 1367270081 25200
# Mon Apr 29 14:14:41 2013 -0700
# Branch stable
# Node ID 1050604e2c9d34112d3fe4eff58321af0d72e816
# Parent 70675d77fd4a78d3e57723550d9f3031345d38e4
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)
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@selenic.com
http://selenic.com/mailman/listinfo/mercurial-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic