aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/tests/command
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-07-25 23:25:46 +0900
committernsfisis <nsfisis@gmail.com>2026-07-25 23:25:46 +0900
commitf47b9ad7e108f29f657459569b2a41f5cdf0a74a (patch)
tree06b98991ceba2b058e07b416078fd76bfa8faf1f /crates/shirabe/tests/command
parent3c39377b0c419dd4cc792aef926032b15c12b69f (diff)
downloadphp-shirabe-f47b9ad7e108f29f657459569b2a41f5cdf0a74a.tar.gz
php-shirabe-f47b9ad7e108f29f657459569b2a41f5cdf0a74a.tar.zst
php-shirabe-f47b9ad7e108f29f657459569b2a41f5cdf0a74a.zip
fix(require-command): end input borrow before asking for confirmation
The `fixed` option was read as a temporary inside the argument list of update_requirements_after_resolution(), so the Ref lived until the end of the enclosing let statement — i.e. across the whole call. When the resolved version looks like a feature branch, that call asks for confirmation, and ConsoleIO takes the same input RefCell mutably, panicking with "RefCell already borrowed". Hoisting the read into its own statement ends the borrow before the call. The expected output of the un-ignored test transcribed PHP's string concatenation operator (`[y,n]? '.'`, used to keep the trailing space visible) as a literal `.`; it now matches RequireCommandTest.php. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/tests/command')
-rw-r--r--crates/shirabe/tests/command/require_command_test.rs8
1 files changed, 2 insertions, 6 deletions
diff --git a/crates/shirabe/tests/command/require_command_test.rs b/crates/shirabe/tests/command/require_command_test.rs
index 2ab3989b..f23a6951 100644
--- a/crates/shirabe/tests/command/require_command_test.rs
+++ b/crates/shirabe/tests/command/require_command_test.rs
@@ -58,10 +58,6 @@ fn test_require_throws_if_none_matches() {
#[test]
#[serial]
-#[ignore = "the pre-operations-exec listener bug is fixed; now fails with \"RefCell already \
- borrowed\" at console_io.rs:366 (ConsoleIO::ask_question, reached via \
- ask_confirmation from RequireCommand::update_requirements_after_resolution) — a \
- re-entrant IO RefCell borrow, unrelated to event dispatching"]
fn test_require_warns_if_resolved_to_feature_branch() {
let composer_json = serde_json::json!({
"repositories": {
@@ -114,8 +110,8 @@ Package operations: 2 installs, 0 updates, 0 removals
- Installing required/pkg (dev-foo-bar)
Using version dev-foo-bar for required/pkg
<warning>Version dev-foo-bar looks like it may be a feature branch which is unlikely to keep working in the long run and may be in an unstable state</warning>
-Are you sure you want to use this constraint (y) or would you rather abort (n) the whole operation [y,n]? .
-Installation failed, reverting ./composer.json to its original content.
+Are you sure you want to use this constraint (y) or would you rather abort (n) the whole operation [y,n]? \
+\nInstallation failed, reverting ./composer.json to its original content.
",
app_tester.get_display()
);