diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-07-20 05:32:30 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-07-20 05:32:30 +0900 |
| commit | 6a2040e9c1b200530269d65e5e57f897a4f95584 (patch) | |
| tree | 461276d06229d4b16892619a9bfa766e613cd71f /crates/shirabe/src/installer/installation_manager.rs | |
| parent | 09755004c6d9396f10a5299a013834224da4e3d5 (diff) | |
| download | php-shirabe-6a2040e9c1b200530269d65e5e57f897a4f95584.tar.gz php-shirabe-6a2040e9c1b200530269d65e5e57f897a4f95584.tar.zst php-shirabe-6a2040e9c1b200530269d65e5e57f897a4f95584.zip | |
fix(installation-manager): un-ignore test_add_remove_installer
Add the __add_installer test seam that registers an installer as a
pre-built Rc handle, so the test can reproduce PHP's object-identity
semantics (assertSame / removeInstaller) via Rc::ptr_eq; add_installer
cannot serve because Rc::from(Box) reallocates, losing the caller's
pointer identity.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/installer/installation_manager.rs')
| -rw-r--r-- | crates/shirabe/src/installer/installation_manager.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/shirabe/src/installer/installation_manager.rs b/crates/shirabe/src/installer/installation_manager.rs index 6c46754c..2d60997c 100644 --- a/crates/shirabe/src/installer/installation_manager.rs +++ b/crates/shirabe/src/installer/installation_manager.rs @@ -133,6 +133,15 @@ impl InstallationManager { self.cache = std::cell::RefCell::new(IndexMap::new()); } + /// For testing only: adds an installer as a pre-built shared handle, so the caller keeps an + /// identity handle usable for PHP `assertSame`-style comparisons (`Rc::ptr_eq`) and for + /// `remove_installer`. `add_installer` cannot serve because `Rc::from(Box)` reallocates, + /// losing the caller's pointer identity. + pub fn __add_installer(&mut self, installer: std::rc::Rc<dyn InstallerInterface>) { + array_unshift(&mut self.installers, installer); + self.cache = std::cell::RefCell::new(IndexMap::new()); + } + /// Removes installer pub fn remove_installer(&mut self, installer: &dyn InstallerInterface) { let target = installer as *const dyn InstallerInterface as *const (); |
