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

login
register
mail settings
Submitter phabricator
Date Feb. 1, 2018, 11:09 p.m.
Message ID <d261b28d1a19722c9989b5e7ec24830f@localhost.localdomain>
Download mbox | patch
Permalink /patch/27170/
State Not Applicable
Headers show

Comments

phabricator - Feb. 1, 2018, 11:09 p.m.
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




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

Patch

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__)