changeset 21836:232038a05fdb

test-context: add test for memctx status
author Sean Farley <sean.michael.farley@gmail.com>
date Fri, 13 Jun 2014 15:56:11 -0700
parents b342c3e2518a
children 61b333b982ea
files tests/test-context.py tests/test-context.py.out
diffstat 2 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/test-context.py	Thu May 29 16:12:59 2014 -0500
+++ b/tests/test-context.py	Fri Jun 13 15:56:11 2014 -0700
@@ -30,3 +30,19 @@
 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)
--- a/tests/test-context.py.out	Thu May 29 16:12:59 2014 -0500
+++ b/tests/test-context.py.out	Fri Jun 13 15:56:11 2014 -0700
@@ -2,3 +2,4 @@
 ASCII   : Gr?ezi!
 Latin-1 : Grüezi!
 UTF-8   : Grüezi!
+(['foo'], [], [], [], [], [], [])