diff options
Diffstat (limited to 'crates/shirabe/tests/common')
| -rw-r--r-- | crates/shirabe/tests/common/io_mock.rs | 15 | ||||
| -rw-r--r-- | crates/shirabe/tests/common/io_stub.rs | 8 |
2 files changed, 13 insertions, 10 deletions
diff --git a/crates/shirabe/tests/common/io_mock.rs b/crates/shirabe/tests/common/io_mock.rs index a658c5bc..ad8d72cd 100644 --- a/crates/shirabe/tests/common/io_mock.rs +++ b/crates/shirabe/tests/common/io_mock.rs @@ -224,7 +224,7 @@ impl IOInterfaceImmutable for IOMock { .overwrite_error4(message, newline, size, verbosity) } - fn ask(&self, question: String, default: PhpMixed) -> PhpMixed { + fn ask(&self, question: String, default: PhpMixed) -> anyhow::Result<PhpMixed> { self.inner .ask(format!("{}{}", trim_eol(&question), PHP_EOL), default) } @@ -249,10 +249,13 @@ impl IOInterfaceImmutable for IOMock { fn ask_and_hide_answer(&self, question: String) -> Option<String> { // Do not hide the answer in tests because that blocks on Windows with // hiddeninput.exe, so PHP delegates to `ask` rather than the hidden variant. - let result = self.inner.ask( - format!("{}{}", trim_eol(&question), PHP_EOL), - PhpMixed::Null, - ); + let result = self + .inner + .ask( + format!("{}{}", trim_eol(&question), PHP_EOL), + PhpMixed::Null, + ) + .expect("QuestionHelper::ask raised an error"); result.as_string().map(|s| s.to_string()) } fn select( @@ -263,7 +266,7 @@ impl IOInterfaceImmutable for IOMock { attempts: PhpMixed, error_message: String, multiselect: bool, - ) -> PhpMixed { + ) -> anyhow::Result<PhpMixed> { self.inner.select( format!("{}{}", trim_eol(&question), PHP_EOL), choices, diff --git a/crates/shirabe/tests/common/io_stub.rs b/crates/shirabe/tests/common/io_stub.rs index b897305e..9feeb5a3 100644 --- a/crates/shirabe/tests/common/io_stub.rs +++ b/crates/shirabe/tests/common/io_stub.rs @@ -217,8 +217,8 @@ impl IOInterfaceImmutable for IOStub { ) { } - fn ask(&self, _question: String, default: PhpMixed) -> PhpMixed { - self.ask.clone().unwrap_or(default) + fn ask(&self, _question: String, default: PhpMixed) -> anyhow::Result<PhpMixed> { + Ok(self.ask.clone().unwrap_or(default)) } fn ask_confirmation(&self, _question: String, default: bool) -> bool { self.ask_confirmation.unwrap_or(default) @@ -251,8 +251,8 @@ impl IOInterfaceImmutable for IOStub { _attempts: PhpMixed, _error_message: String, _multiselect: bool, - ) -> PhpMixed { - default + ) -> anyhow::Result<PhpMixed> { + Ok(default) } fn get_authentications( |
