D1972: tests: start a set of unit tests for mdiff.py, starting with splitnewlines

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Thu Feb 1 18:09:43 EST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG119e4dbdeb29: tests: start a set of unit tests for mdiff.py, starting with splitnewlines (authored by durin42, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1972?vs=5085&id=5103

REVISION DETAIL
  https://phab.mercurial-scm.org/D1972

AFFECTED FILES
  tests/test-mdiff.py

CHANGE DETAILS

diff --git a/tests/test-mdiff.py b/tests/test-mdiff.py
new file mode 100644
--- /dev/null
+++ b/tests/test-mdiff.py
@@ -0,0 +1,24 @@
+from __future__ import absolute_import
+from __future__ import print_function
+
+import unittest
+
+from mercurial import (
+    mdiff,
+)
+
+class splitnewlinesTests(unittest.TestCase):
+
+    def test_splitnewlines(self):
+        cases = {'a\nb\nc\n': ['a\n', 'b\n', 'c\n'],
+                 'a\nb\nc': ['a\n', 'b\n', 'c'],
+                 'a\nb\nc\n\n': ['a\n', 'b\n', 'c\n', '\n'],
+                 '': [],
+                 'abcabc': ['abcabc'],
+                 }
+        for inp, want in cases.iteritems():
+            self.assertEqual(mdiff.splitnewlines(inp), want)
+
+if __name__ == '__main__':
+    import silenttestrunner
+    silenttestrunner.main(__name__)



To: durin42, #hg-reviewers, indygreg
Cc: mercurial-devel


More information about the Mercurial-devel mailing list