aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/util
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-20 03:48:11 +0900
committernsfisis <nsfisis@gmail.com>2026-07-20 03:48:11 +0900
commit112e0125defacba3fcd59cd5f8949b77746264bc (patch)
tree7db674d477527e150a603f0ea22252f06e7e5029 /crates/shirabe/src/util
parentff00c76d2033b0e3bc15aa3fa6e282d72b00cd1f (diff)
downloadphp-shirabe-112e0125defacba3fcd59cd5f8949b77746264bc.tar.gz
php-shirabe-112e0125defacba3fcd59cd5f8949b77746264bc.tar.zst
php-shirabe-112e0125defacba3fcd59cd5f8949b77746264bc.zip
fix(git-downloader): un-ignore test_remove via FilesystemMock path seam
The ignore reason went stale: the FilesystemMock seam added for FileDownloaderTest already intercepts removeDirectoryAsync, and the sibling fossil/hg testRemove ports use it. The seam now records the removed directories instead of a bare call count so the PHP ->with($this->equalTo($this->workingDir)) argument assertion can be reproduced faithfully. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/util')
-rw-r--r--crates/shirabe/src/util/filesystem.rs17
1 files changed, 12 insertions, 5 deletions
diff --git a/crates/shirabe/src/util/filesystem.rs b/crates/shirabe/src/util/filesystem.rs
index 3516b284..51885cc3 100644
--- a/crates/shirabe/src/util/filesystem.rs
+++ b/crates/shirabe/src/util/filesystem.rs
@@ -27,9 +27,9 @@ pub struct Filesystem {
/// Test-only seam mirroring the PHP FileDownloaderTest mock of `Filesystem`.
#[derive(Debug, Default)]
pub struct FilesystemMock {
- /// When `Some`, `remove_directory_async` returns it without touching disk and counts the call.
+ /// When `Some`, `remove_directory_async` returns it without touching disk and records the call.
pub remove_directory_async_result: Option<bool>,
- pub remove_directory_async_calls: usize,
+ pub remove_directory_async_paths: Vec<String>,
/// When true, `normalize_path` returns its argument unchanged.
pub normalize_path_identity: bool,
}
@@ -49,10 +49,16 @@ impl Filesystem {
/// For testing only: number of `remove_directory_async` calls intercepted by the seam.
pub fn __remove_directory_async_calls(&self) -> usize {
+ self.__remove_directory_async_paths().len()
+ }
+
+ /// For testing only: the directories passed to `remove_directory_async` calls intercepted by
+ /// the seam, in call order (ref PHPUnit's `->with($this->equalTo($this->workingDir))`).
+ pub fn __remove_directory_async_paths(&self) -> Vec<String> {
self.mock
.as_ref()
- .map(|m| m.remove_directory_async_calls)
- .unwrap_or(0)
+ .map(|m| m.remove_directory_async_paths.clone())
+ .unwrap_or_default()
}
pub fn remove(&mut self, file: impl AsRef<Path>) -> anyhow::Result<bool> {
@@ -177,7 +183,8 @@ impl Filesystem {
if let Some(mock) = fs.mock.as_mut()
&& let Some(result) = mock.remove_directory_async_result
{
- mock.remove_directory_async_calls += 1;
+ mock.remove_directory_async_paths
+ .push(directory.to_string());
return Ok(result);
}