From 8117e5450693d19726da877bce8aacf5c7aa53af Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 25 Jun 2026 15:12:06 +0900 Subject: test: port 44 vcs/downloader/version tests using mock infra Port git, version_guesser, gitlab_driver, github_driver, and git_downloader tests using the ProcessExecutor/HttpDownloader mocks and IO/Config stubs. Fix production regex-porting bugs surfaced by the now-reachable paths: Url::sanitize and Response::find_header_value had non-delimited PCRE patterns; implement array_search_mixed non-strict branch and a datetime format mapping. Add HttpDownloader::__new_mock so mocked downloaders skip curl construction. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/util/url.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'crates/shirabe/src/util/url.rs') diff --git a/crates/shirabe/src/util/url.rs b/crates/shirabe/src/util/url.rs index 534e318..5820539 100644 --- a/crates/shirabe/src/util/url.rs +++ b/crates/shirabe/src/util/url.rs @@ -164,10 +164,10 @@ impl Url { pub fn sanitize(url: String) -> String { // GitHub repository rename result in redirect locations containing the access_token as GET parameter // e.g. https://api.github.com/repositories/9999999999?access_token=github_token - let url = Preg::replace(r"([&?]access_token=)[^&]+", "$1***", &url); + let url = Preg::replace(r"{([&?]access_token=)[^&]+}", "$1***", &url); Preg::replace_callback( - r"(?i)^(?P[a-z0-9]+://)?(?P[^:/\s@]+):(?P[^@\s/]+)@", + r"{^(?P[a-z0-9]+://)?(?P[^:/\s@]+):(?P[^@\s/]+)@}i", |m| { let user = m .get(&CaptureKey::ByName("user".to_string())) -- cgit v1.3.1