summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2011-08-17 14:27:47 +0200
committerJelmer Vernooij <jelmer@samba.org>2011-08-17 14:27:47 +0200
commit136d5a75dcb5c1b3e057e069efeae5ef14f31dba (patch)
tree11608d9e9d8f448051ae5cdf14a1cafa9969f86e /tests
parentbb48331ccc7560ce05cd83d0df17f6ff4713a15b (diff)
downloadbzr-fastimport-136d5a75dcb5c1b3e057e069efeae5ef14f31dba.tar.gz
In "plain" mode, skip tags that contain characters not valid in Git.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_exporter.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_exporter.py b/tests/test_exporter.py
index fe50e3b..24fedb1 100644
--- a/tests/test_exporter.py
+++ b/tests/test_exporter.py
@@ -24,6 +24,7 @@ from bzrlib import tests
from bzrlib.plugins.fastimport.exporter import (
_get_output_stream,
+ check_ref_format,
)
from bzrlib.plugins.fastimport.tests import (
@@ -60,3 +61,30 @@ class TestOutputStream(tests.TestCase):
f = open(filename, 'r')
self.assertEquals("foo", f.read())
f.close()
+
+
+# from dulwich.tests.test_repository:
+class CheckRefFormatTests(tests.TestCase):
+ """Tests for the check_ref_format function.
+
+ These are the same tests as in the git test suite.
+ """
+
+ def test_valid(self):
+ self.assertTrue(check_ref_format('heads/foo'))
+ self.assertTrue(check_ref_format('foo/bar/baz'))
+ self.assertTrue(check_ref_format('refs///heads/foo'))
+ self.assertTrue(check_ref_format('foo./bar'))
+ self.assertTrue(check_ref_format('heads/foo@bar'))
+ self.assertTrue(check_ref_format('heads/fix.lock.error'))
+
+ def test_invalid(self):
+ self.assertFalse(check_ref_format('foo'))
+ self.assertFalse(check_ref_format('heads/foo/'))
+ self.assertFalse(check_ref_format('./foo'))
+ self.assertFalse(check_ref_format('.refs/foo'))
+ self.assertFalse(check_ref_format('heads/foo..bar'))
+ self.assertFalse(check_ref_format('heads/foo?bar'))
+ self.assertFalse(check_ref_format('heads/foo.lock'))
+ self.assertFalse(check_ref_format('heads/v@{ation'))
+ self.assertFalse(check_ref_format('heads/foo\bar'))