[PATCH hglib] tests: introduce basic test for add and addremove

Andrey Somov py4fun at gmail.com
Fri Feb 3 15:14:48 UTC 2012


# HG changeset patch
# User py4fun
# Date 1328216672 -3600
# Node ID eae2e123ec7f4f525f4c1b80275450825c16b98f
# Parent  e5d3b0aa48e6ab79531204f61e25ee335b306df3
tests: introduce basic test for add and addremove

diff -r e5d3b0aa48e6 -r eae2e123ec7f tests/test-add.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-add.py	Thu Feb 02 22:04:32 2012 +0100
@@ -0,0 +1,26 @@
+import common
+
+class test_add(common.basetest):
+    def test_add(self):
+        self.append('a', 'a\n')
+        self.assertTrue(self.client.add('a'))
+        rev, node0 = self.client.commit('first', addremove=False)
+        ctx0 = self.client[node0]
+        self.assertEquals(ctx0.manifest(),  {'a' : 'b789fdd96dc2f3bd229c1dd8eedf0fc60e2b68e3'})
+        self.assertEquals(ctx0.added(), ['a'])
+       
+    def test_addremove(self):
+        self.append('b', 'b\n')
+        self.assertTrue(self.client.addremove())
+        rev, node0 = self.client.commit('first', addremove=False)
+        ctx0 = self.client[node0]
+        self.assertEquals(ctx0.manifest(), {'b' : '1e88685f5ddec574a34c70af492f95b6debc8741'})
+        self.assertEquals(ctx0.added(), ['b'])
+        
+    def test_add_non_existing(self):
+        self.append('a', 'a\n')
+        self.assertFalse(self.client.add('b'))
+        #TODO self.assertFalse(self.client.addremove('b'))
+        # this is not how it is defined - b does not exist, addremove should return False
+        self.assertTrue(self.client.addremove('b'))
+       



More information about the Mercurial-devel mailing list