|
38 | 38 | decygpath, |
39 | 39 | get_user_id, |
40 | 40 | is_cygwin_git, |
| 41 | + join_path, |
41 | 42 | remove_password_if_present, |
42 | 43 | rmtree, |
43 | 44 | ) |
|
46 | 47 | from test.lib import TestBase, requires_symlinks, with_rw_repo |
47 | 48 |
|
48 | 49 |
|
| 50 | +@pytest.mark.parametrize( |
| 51 | + "parts, expected", |
| 52 | + [ |
| 53 | + (("parent", "/child"), "parent/child"), |
| 54 | + (("parent", "/child", "/leaf"), "parent/child/leaf"), |
| 55 | + ((pathlib.Path("parent"), "/child"), "parent/child"), |
| 56 | + (("parent/", "/child"), "parent/child"), |
| 57 | + (("parent", "child"), "parent/child"), |
| 58 | + (("", "/child"), "child"), |
| 59 | + (("/", "/child"), "/child"), |
| 60 | + (("parent", "", "child"), "parent/child"), |
| 61 | + (("parent", "//child"), "parent/child"), |
| 62 | + (("/parent/", "///child"), "/parent/child"), |
| 63 | + (("parent", "///"), "parent"), |
| 64 | + ], |
| 65 | +) |
| 66 | +def test_join_path_keeps_later_tokens_relative(parts, expected): |
| 67 | + assert join_path(*parts) == expected |
| 68 | + |
| 69 | + |
49 | 70 | @pytest.fixture |
50 | 71 | def tmp_path(request): |
51 | 72 | # Unreadable files and symlinks cannot be copied by native fixture tooling. |
|
0 commit comments