File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -1035,6 +1035,33 @@ impl AssertError {
10351035 fn panic < T > ( self ) -> T {
10361036 panic ! ( "{}" , self )
10371037 }
1038+
1039+ /// Returns the [`Assert`] wrapped into the [`Result`] produced by
1040+ /// the `try_` variants of the [`Assert`] methods.
1041+ ///
1042+ /// # Examples
1043+ ///
1044+ /// ```rust,no_run
1045+ /// use assert_cmd::prelude::*;
1046+ ///
1047+ /// use std::process::Command;
1048+ /// use predicates::prelude::*;
1049+ ///
1050+ /// let result = Command::new("echo")
1051+ /// .assert();
1052+ ///
1053+ /// match result.try_success() {
1054+ /// Ok(assert) => {
1055+ /// assert.stdout(predicate::eq(b"Success\n" as &[u8]));
1056+ /// }
1057+ /// Err(err) => {
1058+ /// err.assert().stdout(predicate::eq(b"Err but some specific output you might want to check\n" as &[u8]));
1059+ /// }
1060+ /// }
1061+ /// ```
1062+ pub fn assert ( self ) -> Assert {
1063+ self . assert
1064+ }
10381065}
10391066
10401067impl Error for AssertError { }
You can’t perform that action at this time.
0 commit comments