Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(bolero-generator): add trace utility #240

Merged
merged 2 commits into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/bolero-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,14 @@ rand_core = { version = "0.6", default-features = false }

[dev-dependencies]
rand = "0.8"

[lints.rust.unexpected_cfgs]
level = "warn"
check-cfg = [
'cfg(kani)',
'cfg(fuzzing)',
'cfg(fuzzing_afl)',
'cfg(fuzzing_libfuzzer)',
'cfg(fuzzing_honggfuzz)',
'cfg(fuzzing_random)'
]
9 changes: 9 additions & 0 deletions lib/bolero-generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ pub mod one_of;
pub mod range;
pub mod result;
pub mod time;
#[cfg(feature = "std")]
pub mod trace;
pub mod tuple;

#[cfg(feature = "arbitrary")]
Expand Down Expand Up @@ -143,6 +145,13 @@ pub trait ValueGenerator: Sized {
filter_map,
}
}

/// Traces generated values to `stderr`
#[cfg(feature = "std")]
#[inline]
fn trace(self) -> trace::Trace<Self> {
trace::Trace::new(self)
}
}

impl<'a, T: ValueGenerator> ValueGenerator for &'a T {
Expand Down
Loading
Loading