[PATCH 4 of 5] test-context: add test for memctx status

Sean Farley sean.michael.farley at gmail.com
Fri Jun 13 18:56:05 CDT 2014


# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1402700171 25200
#      Fri Jun 13 15:56:11 2014 -0700
# Node ID 9bb33f5b140fac3fbc4d97c18f7c17d36835ef15
# Parent  8bc35c83920f4a20a1de3e020662d73fa949c0a3
test-context: add test for memctx status

diff --git a/tests/test-context.py b/tests/test-context.py
--- a/tests/test-context.py
+++ b/tests/test-context.py
@@ -28,5 +28,21 @@ ctx = context.memctx(repo, ['tip', None]
                      ["foo"], filectxfn)
 ctx.commit()
 for enc in "ASCII", "Latin-1", "UTF-8":
     encoding.encoding = enc
     print "%-8s: %s" % (enc, repo["tip"].description())
+
+# test performing a status
+
+def getfilectx(repo, memctx, f):
+    fctx = memctx.parents()[0][f]
+    data, flags = fctx.data(), fctx.flags()
+    if f == 'foo':
+        data += 'bar\n'
+    return context.memfilectx(repo, f, data, 'l' in flags, 'x' in flags)
+
+ctxa = repo.changectx(0)
+ctxb = context.memctx(repo, [ctxa.node(), None],
+                      "test diff",
+                      ["foo"], getfilectx)
+
+print ctxb.status(ctxa)
diff --git a/tests/test-context.py.out b/tests/test-context.py.out
--- a/tests/test-context.py.out
+++ b/tests/test-context.py.out
@@ -1,4 +1,5 @@
 workingfilectx.date = (1000, 0)
 ASCII   : Gr?ezi!
 Latin-1 : Grüezi!
 UTF-8   : Grüezi!
+(['foo'], [], [], [], [], [], [])


More information about the Mercurial-devel mailing list