From 46845eff8d1398f35099a0ef914f77bcaf473287 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 10 May 2026 15:29:19 +0900 Subject: refactor(io): introduce IoInterface trait mirroring Composer IOInterface Add an `IoInterface` trait in mozart-core::console that mirrors `\Composer\IO\IOInterface`, implement it for `Console`, and switch commands, the auditor, and the suggested-packages reporter to accept the abstracted IO (typically `Arc>>` at the command boundary, `&dyn IoInterface` deeper down) instead of `&Console`. The console_writeln\!/write\! macros now go through `IoInterface::verbosity()` via the lock so any implementor works. --- crates/mozart/tests/installer.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'crates/mozart/tests') diff --git a/crates/mozart/tests/installer.rs b/crates/mozart/tests/installer.rs index 970fce4..fbeba6d 100644 --- a/crates/mozart/tests/installer.rs +++ b/crates/mozart/tests/installer.rs @@ -9,11 +9,11 @@ //! Composer's PHPUnit suite uses. use std::path::{Path, PathBuf}; -use std::sync::Arc; +use std::sync::{Arc, Mutex}; use clap::Parser; use mozart::commands::{Cli, Commands, install, update}; -use mozart_core::console::Console; +use mozart_core::console::{Console, IoInterface}; use mozart_core::exit_code::MozartError; use mozart_core::repository::installer_executor::TraceRecorderExecutor; use mozart_core::repository::repository::RepositorySet; @@ -108,7 +108,10 @@ async fn run_fixture_in_process(test: &ParsedTest) -> anyhow::Result>> = Arc::new(Mutex::new(Box::new(Console::new( + 0, true, false, true, true, + )) + as Box)); let repositories = Arc::new(RepositorySet::empty()); let mut executor = TraceRecorderExecutor::new(); @@ -119,7 +122,7 @@ async fn run_fixture_in_process(test: &ParsedTest) -> anyhow::Result anyhow::Result