1
0
mirror of https://github.com/TheLocehiliosan/yadm synced 2026-03-02 03:49:29 +00:00

Make relative_path match full dir and not just a prefix

Before this change, relative_path "/A/B/C" "/A/B/CD" would return "" instead of
the correct "../CD".
This commit is contained in:
Erik Flodin
2024-12-03 22:52:58 +01:00
parent 0b91140ea8
commit b164d03594
2 changed files with 53 additions and 53 deletions

View File

@@ -11,11 +11,16 @@ import pytest
("/A/B/C", "/A/B/C", ""),
("/A/B/C", "/A/B/C/D", "D"),
("/A/B/C", "/A/B/C/D/E", "D/E"),
("/A/B/C", "/A/B/CD", "../CD"),
("/A/B/C", "/A/BB/C", "../../BB/C"),
("/A/B/C", "/A/B/D", "../D"),
("/A/B/C", "/A/B/D/E", "../D/E"),
("/A/B/C", "/A/D", "../../D"),
("/A/B/C", "/A/D/E", "../../D/E"),
("/A/B/C", "/D/E/F", "../../../D/E/F"),
("/", "/A/B/C", "A/B/C"),
("/A/B/C", "/", "../../.."),
("/A/B B/C", "/A/C C/D", "../../C C/D"),
],
)
def test_relative_path(runner, paths, base, full_path, expected):