Module sentry_core::test
source · Expand description
This provides testing functionality for building tests.
Feature: test
(disabled by default)
If the sentry crate has been compiled with the test support feature this module becomes available and provides functionality to capture events in a block.
§Example usage
use sentry::test::with_captured_events;
use sentry::{capture_message, Level};
let events = with_captured_events(|| {
capture_message("Hello World!", Level::Warning);
});
assert_eq!(events.len(), 1);
assert_eq!(events[0].message.as_ref().unwrap(), "Hello World!");
Structs§
- Collects events instead of sending them.
Functions§
- Runs some code with the default test hub and returns the captured envelopes.
- Runs some code with the default test hub with the given options and returns the captured envelopes.
- Runs some code with the default test hub and returns the captured events.
- Runs some code with the default test hub with the given options and returns the captured events.