pub struct CommandOutput {
pub status: ExitStatus,
pub stdout: Vec<u8>,
pub stderr: Vec<u8>,
}Expand description
Output captured from a CLI integration test.
command! runs the package’s compiled binary, so this includes the same stdout, stderr,
and exit status a user receives. Keep these tests under tests/: Cargo defines the binary
path for integration tests, not for a crate’s unit tests.
Fields§
§status: ExitStatusThe process exit status.
stdout: Vec<u8>Stdout exactly as the process wrote it.
stderr: Vec<u8>Stderr exactly as the process wrote it.
Implementations§
Source§impl CommandOutput
impl CommandOutput
Sourcepub fn assert_success(self) -> Self
pub fn assert_success(self) -> Self
Assert that the command succeeded, printing stderr when it did not.
Sourcepub fn stdout_text(&self) -> &str
pub fn stdout_text(&self) -> &str
Stdout as UTF-8.
Use the public Self::stdout bytes directly when non-UTF-8 output is intentional.
Sourcepub fn stderr_text(&self) -> &str
pub fn stderr_text(&self) -> &str
Stderr as UTF-8.
Use the public Self::stderr bytes directly when non-UTF-8 output is intentional.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CommandOutput
impl RefUnwindSafe for CommandOutput
impl Send for CommandOutput
impl Sync for CommandOutput
impl Unpin for CommandOutput
impl UnsafeUnpin for CommandOutput
impl UnwindSafe for CommandOutput
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more