tests/test-bundle2.t
changeset 20802 520df53ad26a
parent 20801 9c5183cb9bca
child 20803 88db3e615319
--- a/tests/test-bundle2.t	Tue Mar 18 14:00:50 2014 -0700
+++ b/tests/test-bundle2.t	Tue Mar 18 14:28:42 2014 -0700
@@ -8,6 +8,7 @@
   > code. We still need to be able to test it while it grow up.
   > """
   > 
+  > import sys
   > from mercurial import cmdutil
   > from mercurial import bundle2
   > cmdtable = {}
@@ -19,6 +20,14 @@
   >     bundle = bundle2.bundle20()
   >     for chunk in bundle.getchunks():
   >         ui.write(chunk)
+  > 
+  > @command('unbundle2', [], '')
+  > def cmdunbundle2(ui, repo):
+  >     """read a bundle2 container from standard input"""
+  >     unbundler = bundle2.unbundle20(sys.stdin)
+  >     ui.write('options count: %i\n' % len(unbundler.params))
+  >     parts = list(unbundler)
+  >     ui.write('parts count:   %i\n' % len(parts))
   > EOF
   $ cat >> $HGRCPATH << EOF
   > [extensions]
@@ -34,3 +43,9 @@
 
   $ hg bundle2
   HG20\x00\x00\x00\x00 (no-eol) (esc)
+
+Test parsing of an empty bundle
+
+  $ hg bundle2 | hg unbundle2
+  options count: 0
+  parts count:   0