Mercurial > python-hglib
diff tests/test_log.py @ 225:fba806958dba
tests: add regression test to check for null byte handling
author | Mathias De Mare <mathias.de_mare@nokia.com> |
---|---|
date | Tue, 14 Mar 2023 14:35:58 +0100 |
parents | a2afbf236ca8 |
children |
line wrap: on
line diff
--- a/tests/test_log.py Mon Mar 13 15:32:20 2023 +0100 +++ b/tests/test_log.py Tue Mar 14 14:35:58 2023 +0100 @@ -1,6 +1,7 @@ from tests import common import hglib from hglib.util import b +import subprocess class test_log(common.basetest): def test_basic(self): @@ -34,6 +35,17 @@ self.assertTrue(len(revs) == 1) self.assertEqual(revs[0].rev, b('0')) + def test_null_byte(self): + self.append('a', 'a') + with open('commitmessagenullbyte', 'w') as f: + f.write('some message\0more stuff') + # use 'hg' directly here as hglib doesn't allow + # committing null byte descriptions + subprocess.check_call(["hg", "commit", + "-l", "commitmessagenullbyte", "--addremove", "-q"]) + revs = self.client.log(revrange=b('.')) + self.assertEqual(revs[0].desc, b('some message\0more stuff')) + # def test_errors(self): # self.assertRaisesRegexp(CommandError, 'abort: unknown revision', # self.client.log, 'foo')