Skip to content
Snippets Groups Projects
Commit 1ab7b16c authored by Augie Fackler's avatar Augie Fackler
Browse files

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

I want to optimize splitnewlines, so writing tests seems prudent.

Differential Revision: https://phab.mercurial-scm.org/D1972

# no-check-commit because of test_ funciton
parent ed939545
No related branches found
No related tags found
No related merge requests found
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__)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment