[][src]Module sentry::test

This provides testing functionality for building tests.

Feature: with_test_support (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::{capture_message, Level};
use sentry::test::with_captured_events;

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

TestTransport

Collects events instead of sending them.

Functions

with_captured_events

Runs some code with the default test hub and returns the captured events.

with_captured_events_options

Runs some code with the default test hub with the given options and returns the captured events.