MCPcopy Index your code
hub / github.com/assert-rs/assert_cmd / code_impl

Method code_impl

src/assert.rs:298–310  ·  view source on GitHub ↗
(self, pred: &dyn predicates_core::Predicate<i32>)

Source from the content-addressed store, hash-verified

296 }
297
298 fn code_impl(self, pred: &dyn predicates_core::Predicate<i32>) -> AssertResult {
299 let actual_code = if let Some(actual_code) = self.output.status.code() {
300 actual_code
301 } else {
302 return Err(self.into_error(AssertReason::CommandInterrupted));
303 };
304 if let Some(case) = pred.find_case(false, &actual_code) {
305 return Err(self.into_error(AssertReason::UnexpectedReturnCode {
306 case_tree: CaseTree(case.tree()),
307 }));
308 }
309 Ok(self)
310 }
311
312 /// Ensure the command wrote the expected data to `stdout`.
313 ///

Callers 1

try_codeMethod · 0.80

Calls 4

CaseTreeClass · 0.85
codeMethod · 0.80
into_errorMethod · 0.80
find_caseMethod · 0.80

Tested by

no test coverage detected