From 6a2040e9c1b200530269d65e5e57f897a4f95584 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 20 Jul 2026 05:32:30 +0900 Subject: 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 --- crates/shirabe/src/installer/installation_manager.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'crates/shirabe/src') 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) { + 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 (); -- cgit v1.3.1