tests/test-mdiff.py
author Pulkit Goyal <7895pulkit@gmail.com>
Sat, 23 Dec 2017 17:50:42 +0530
changeset 36099 be72f6420f3c
parent 35902 1ab7b16c9437
child 36360 58c1368ab629
permissions -rw-r--r--
remotenames: introduce a class to lazily resolve remotnames remotenames may take time to load and in next patch we are going to introduce namespaces related to them. So let's introduce a class making them load lazily. This is a part of moving hgremotenames extension to core. hgremotenames: https://bitbucket.org/seanfarley/hgremotenames Differential Revision: https://phab.mercurial-scm.org/D1757

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