view tests/test-mdiff.py @ 36160:9fd8c2a3db5a

narrowspec: move module into core Having support for parsing the narrow specification in core is necessary for moving many other parts of narrow to core. We do still want to harmonize the narrow spec with the sparse spec. And the format needs to be documented. But this shouldn't hold up the code moving to core. Differential Revision: https://phab.mercurial-scm.org/D2201
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 12 Feb 2018 16:21:34 -0800
parents 1ab7b16c9437
children 58c1368ab629
line wrap: on
line source

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