--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-encoding-func.py Sun Apr 23 12:59:42 2017 +0900
@@ -0,0 +1,33 @@
+from __future__ import absolute_import
+
+import unittest
+
+from mercurial import (
+ encoding,
+)
+
+class IsasciistrTest(unittest.TestCase):
+ asciistrs = [
+ b'a',
+ b'ab',
+ b'abc',
+ b'abcd',
+ b'abcde',
+ b'abcdefghi',
+ b'abcd\0fghi',
+ ]
+
+ def testascii(self):
+ for s in self.asciistrs:
+ self.assertTrue(encoding.isasciistr(s))
+
+ def testnonasciichar(self):
+ for s in self.asciistrs:
+ for i in range(len(s)):
+ t = bytearray(s)
+ t[i] |= 0x80
+ self.assertFalse(encoding.isasciistr(bytes(t)))
+
+if __name__ == '__main__':
+ import silenttestrunner
+ silenttestrunner.main(__name__)