Crate diagnostics_assertions

Source
Expand description

Utilities to assert the structure of a DiagnosticsHierarchy.

Pretty much the useful assert_data_tree macro plus some utilities for it.

Macros§

assert_data_tree
Macro to simplify tree matching in tests. The first argument is the actual tree passed as a DiagnosticsHierarchyGetter (e.g. a DiagnosticsHierarchy or an Inspector). The second argument is given to tree_assertion! which creates a TreeAssertion to validate the tree.
assert_json_diff
Macro to check a hierarchy with a nice JSON diff. The syntax of the expected value is the same as that of hierarchy!, and essentially the same as assert_data_tree!, except that partial tree matching is not supported (i.e. the keyword contains).
hierarchy
This macro simplifies creating diagnostics hierarchies, to remove the need of writing multiple nested hierarchies and manually writing all properties.
tree_assertion
Macro to simplify creating TreeAssertions. Commonly used indirectly through the second parameter of assert_data_tree!. See assert_data_tree! for more usage examples.

Structs§

AnyBoolProperty
A PropertyAssertion that passes for any Boolean.
AnyBytesProperty
A PropertyAssertion that passes for any Bytes.
AnyDoubleProperty
A PropertyAssertion that passes for any Double.
AnyIntProperty
A PropertyAssertion that passes for any Int.
AnyNumericProperty
A PropertyAssertion that passes for any Int, Uint, or Double.
AnyProperty
A PropertyAssertion that always passes
AnyStringProperty
A PropertyAssertion that passes for any String.
AnyUintProperty
A PropertyAssertion that passes for any Uint.
DiagnosticsHierarchy
A hierarchy of nodes representing structured data, such as Inspect or structured log data.
Diff
A difference between expected and actual output.
HistogramAssertion
An assertion for a histogram property.
NonZeroIntProperty
A PropertyAssertion that passes for non-zero, signed integers.
NonZeroUintProperty
A PropertyAssertion that passes for non-zero, unsigned integers.
TreeAssertion
Struct for matching against a Data tree (DiagnosticsHierarchy).

Traits§

DiagnosticsHierarchyGetter
A type which can function as a “view” into a diagnostics hierarchy, optionally allocating a new instance to service a request.
JsonGetter
PropertyAssertion
Trait implemented by types that can act as properies for assertion.