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/repository/vcs/github_driver.rs | 12 ++++++++++++ crates/shirabe/src/repository/vcs/gitlab_driver.rs | 12 ++++++++++++ 2 files changed, 24 insertions(+) (limited to 'crates/shirabe/src/repository') diff --git a/crates/shirabe/src/repository/vcs/github_driver.rs b/crates/shirabe/src/repository/vcs/github_driver.rs index bea7294..7c50a7e 100644 --- a/crates/shirabe/src/repository/vcs/github_driver.rs +++ b/crates/shirabe/src/repository/vcs/github_driver.rs @@ -1298,6 +1298,18 @@ impl GitHubDriver { None } + + /// For testing only. Mirrors the `setAttribute($driver, 'tags', ...)` reflection + /// helper used by GitHubDriverTest to seed private state. + pub fn __set_tags(&mut self, tags: Option>) { + self.tags = tags; + } + + /// For testing only. Mirrors the `setAttribute($driver, 'branches', ...)` reflection + /// helper used by GitHubDriverTest to seed private state. + pub fn __set_branches(&mut self, branches: Option>) { + self.branches = branches; + } } impl crate::repository::vcs::VcsDriverInterface for GitHubDriver { diff --git a/crates/shirabe/src/repository/vcs/gitlab_driver.rs b/crates/shirabe/src/repository/vcs/gitlab_driver.rs index f1f361e..7e8073d 100644 --- a/crates/shirabe/src/repository/vcs/gitlab_driver.rs +++ b/crates/shirabe/src/repository/vcs/gitlab_driver.rs @@ -238,6 +238,18 @@ impl GitLabDriver { Ok(()) } + /// For testing only. Mirrors the `setAttribute($driver, 'branches', ...)` reflection + /// helper used by GitLabDriverTest to seed private state. + pub fn __set_branches(&mut self, branches: Option>) { + self.branches = branches; + } + + /// For testing only. Mirrors the `setAttribute($driver, 'tags', ...)` reflection + /// helper used by GitLabDriverTest to seed private state. + pub fn __set_tags(&mut self, tags: Option>) { + self.tags = tags; + } + /// Updates the HttpDownloader instance. /// Mainly useful for tests. /// -- cgit v1.3.1