Source

thg-qt-mq / test-commit-noop.diff

# HG changeset patch
# Parent cbbb9c2b448b773a5b66a466d75d947fa3db9b3b
tests: add test for commit of noop merge (fixed by 8116cfd8b2f3)

diff --git a/tests/functional/commit_test.py b/tests/functional/commit_test.py
new file mode 100644
--- /dev/null
+++ b/tests/functional/commit_test.py
@@ -0,0 +1,38 @@
+import os, time, unittest
+
+import helpers
+
+def setup():
+    global _tmpdir
+    _tmpdir = helpers.mktmpdir(__name__)
+
+class CommitNoopMergeTest(unittest.TestCase):
+    """Commit of merge changeset with no file modification"""
+    def setUp(self):
+        self.hg = helpers.HgClient(os.path.join(_tmpdir,
+                                                self.__class__.__name__))
+        self.hg.init()
+        self.hg.fwrite('a', 'foo\n')
+        self.hg.commit('-Am', 'foo')
+        for m in ('first', 'second'):
+            self.hg.update('0')
+            self.hg.fappend('a', 'bar\n')
+            self.hg.commit('-m', '%s bar' % m)
+        self.hg.merge()
+
+        self.thg = helpers.openthg(['commit', '-R', self.hg.path])
+
+    def tearDown(self):
+        self.thg.close()
+
+    def test_commit(self):
+        self.thg.exec_('dlg.commit.setMessage("merge")')
+        self.thg.exec_('dlg.accept()')
+        for _i in xrange(10):
+            time.sleep(0.1)
+            if self.thg.eval('dlg.commitButton.isEnabled()'):
+                break
+        else:
+            self.fail('commit timed out')
+        _r, sout, _serr = self.hg.parents('--template', '{rev}\n')
+        self.assertEqual(['3'], sout.splitlines())