diff options
Diffstat (limited to 'tests/test_manifest_xml.py')
-rw-r--r-- | tests/test_manifest_xml.py | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index 9060ef3d..eda06968 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py | |||
@@ -32,6 +32,7 @@ INVALID_FS_PATHS = ( | |||
32 | '..', | 32 | '..', |
33 | '../', | 33 | '../', |
34 | './', | 34 | './', |
35 | './/', | ||
35 | 'foo/', | 36 | 'foo/', |
36 | './foo', | 37 | './foo', |
37 | '../foo', | 38 | '../foo', |
@@ -427,6 +428,28 @@ class ProjectElementTests(ManifestParseTestCase): | |||
427 | self.assertEqual(manifest.projects[0].objdir, | 428 | self.assertEqual(manifest.projects[0].objdir, |
428 | os.path.join(self.tempdir, '.repo/project-objects/a/path.git')) | 429 | os.path.join(self.tempdir, '.repo/project-objects/a/path.git')) |
429 | 430 | ||
431 | manifest = parse('a/path', 'foo//////') | ||
432 | self.assertEqual(manifest.projects[0].gitdir, | ||
433 | os.path.join(self.tempdir, '.repo/projects/foo.git')) | ||
434 | self.assertEqual(manifest.projects[0].objdir, | ||
435 | os.path.join(self.tempdir, '.repo/project-objects/a/path.git')) | ||
436 | |||
437 | def test_toplevel_path(self): | ||
438 | """Check handling of path=. specially.""" | ||
439 | def parse(name, path): | ||
440 | return self.getXmlManifest(f""" | ||
441 | <manifest> | ||
442 | <remote name="default-remote" fetch="http://localhost" /> | ||
443 | <default remote="default-remote" revision="refs/heads/main" /> | ||
444 | <project name="{name}" path="{path}" /> | ||
445 | </manifest> | ||
446 | """) | ||
447 | |||
448 | for path in ('.', './', './/', './//'): | ||
449 | manifest = parse('server/path', path) | ||
450 | self.assertEqual(manifest.projects[0].gitdir, | ||
451 | os.path.join(self.tempdir, '.repo/projects/..git')) | ||
452 | |||
430 | def test_bad_path_name_checks(self): | 453 | def test_bad_path_name_checks(self): |
431 | """Check handling of bad path & name attributes.""" | 454 | """Check handling of bad path & name attributes.""" |
432 | def parse(name, path): | 455 | def parse(name, path): |
@@ -454,8 +477,11 @@ class ProjectElementTests(ManifestParseTestCase): | |||
454 | 477 | ||
455 | with self.assertRaises(error.ManifestInvalidPathError): | 478 | with self.assertRaises(error.ManifestInvalidPathError): |
456 | parse(path, 'ok') | 479 | parse(path, 'ok') |
457 | with self.assertRaises(error.ManifestInvalidPathError): | 480 | |
458 | parse('ok', path) | 481 | # We have a dedicated test for path=".". |
482 | if path not in {'.'}: | ||
483 | with self.assertRaises(error.ManifestInvalidPathError): | ||
484 | parse('ok', path) | ||
459 | 485 | ||
460 | 486 | ||
461 | class SuperProjectElementTests(ManifestParseTestCase): | 487 | class SuperProjectElementTests(ManifestParseTestCase): |