From 15af2ebb5a5b364ff8f574da8cda7a3525dd32de Mon Sep 17 00:00:00 2001 From: Abdessamad Derraz <3028866+Abdess@users.noreply.github.com> Date: Mon, 23 Nov 2026 23:09:02 +0100 Subject: [PATCH] fix: count a wrapped path as part of its path --- tests/test_install_journeys.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/test_install_journeys.py b/tests/test_install_journeys.py index 731ae3ab3..87e750d63 100644 --- a/tests/test_install_journeys.py +++ b/tests/test_install_journeys.py @@ -92,9 +92,19 @@ LINE_TEXT = { def words(text: str) -> int: - """Words a reader reads, a path left out.""" - return sum(1 for token in text.split() if re.search(r"[A-Za-z0-9]", token) - and "/" not in token) + """Words a reader reads, a path left out, the part a long path wraps onto + the next line included: the scratch folder's length is the machine's, and + a worktree's longer one cut the path after its last slash.""" + count = 0 + previous = "" + for line in text.splitlines(): + tokens = line.split() + if tokens and "/" in previous and re.fullmatch(r"[\w.\-]+", tokens[0]): + tokens = tokens[1:] + count += sum(1 for token in tokens if re.search(r"[A-Za-z0-9]", token) + and "/" not in token) + previous = line.split()[-1] if line.split() else "" + return count def lines(text: str) -> int: