tests/test-mdiff.py
author Boris Feld <boris.feld@octobus.net>
Thu, 27 Dec 2018 23:34:37 +0100
branchstable
changeset 41018 f4113489e4d4
parent 36328 8d0b0b533e09
child 43076 2372284d9457
permissions -rw-r--r--
revlog: catch revlog corruption in index_baserev A revision cannot use a base above itself, it can only happens one corrupted repository. Ignoring such corrupted could lead to infinite loop.

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 = {b'a\nb\nc\n': [b'a\n', b'b\n', b'c\n'],
                 b'a\nb\nc': [b'a\n', b'b\n', b'c'],
                 b'a\nb\nc\n\n': [b'a\n', b'b\n', b'c\n', b'\n'],
                 b'': [],
                 b'abcabc': [b'abcabc'],
                 }
        for inp, want in cases.items():
            self.assertEqual(mdiff.splitnewlines(inp), want)

if __name__ == '__main__':
    import silenttestrunner
    silenttestrunner.main(__name__)