tests/test-mdiff.py
author Augie Fackler <augie@google.com>
Sat, 17 Feb 2018 21:25:14 -0500
changeset 36270 2d513ab7ce94
parent 35862 1ab7b16c9437
child 36327 58c1368ab629
permissions -rw-r--r--
httppeer: use %d to format int Differential Revision: https://phab.mercurial-scm.org/D2300

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