MCPcopy Create free account
hub / github.com/hashintel/hash / single_error

Function single_error

libs/error-stack/src/ext/tuple.rs:145–156  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

143
144 #[test]
145 fn single_error() {
146 let result1: Result<i32, Report<TestError>> = Ok(1);
147 let result2: Result<String, Report<TestError>> = Ok("test".to_owned());
148 let result3: Result<bool, Report<TestError>> = Err(Report::new(TestError(0)));
149
150 let combined = (result1, result2, result3).try_collect();
151 let report = combined.expect_err("should have error");
152
153 let contexts: BTreeSet<_> = report.current_contexts().collect();
154 assert_eq!(contexts.len(), 1);
155 assert!(contexts.contains(&TestError(0)));
156 }
157
158 #[test]
159 fn no_error() {

Callers

nothing calls this directly

Calls 7

OkInterface · 0.85
ErrInterface · 0.85
try_collectMethod · 0.80
collectMethod · 0.80
current_contextsMethod · 0.80
TestErrorClass · 0.70
to_ownedMethod · 0.45

Tested by

no test coverage detected