Trait GroupRunEventByTestCase

Source
pub trait GroupRunEventByTestCase: Iterator<Item = RunEvent> + Sized {
    // Provided methods
    fn group_by_test_case_ordered(
        self,
    ) -> LinkedHashMap<Option<String>, GroupedRunEvents> { ... }
    fn group_by_test_case_unordered(
        self,
    ) -> HashMap<Option<String>, GroupedRunEvents> { ... }
    fn group(self) -> GroupedRunEvents { ... }
}
Expand description

Trait allowing iterators over RunEvent to be partitioned by test case name.

Provided Methods§

Source

fn group_by_test_case_ordered( self, ) -> LinkedHashMap<Option<String>, GroupedRunEvents>

Groups the RunEvents by test case name into a map that preserves insertion order of various types of events. The overall order of test cases (by first event) and the orders of events within each test case are preserved, but events from different test cases are effectively de-interleaved.

Example:

use test_diagnostics::{RunEvent, GroupRunEventByTestCase as _};
use linked_hash_map::LinkedHashMap;

let events: Vec<RunEvent> = get_events();
let grouped: LinkedHashMap<Option<String>, GroupedRunEvents> =
    events.into_iter().group_by_test_case_ordered();
Source

fn group_by_test_case_unordered( self, ) -> HashMap<Option<String>, GroupedRunEvents>

Groups the RunEvents by test case name into an unordered map. The orders of events within each test case are preserved, but the test cases themselves are not in a defined order.

Source

fn group(self) -> GroupedRunEvents

Group RunEvents by stdout, stderr and non-stdout/err events and returns GroupedRunEvents.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T> GroupRunEventByTestCase for T
where T: Iterator<Item = RunEvent> + Sized,