Skip to content

Commit

Permalink
A trick to make one of the doc tests actually run.
Browse files Browse the repository at this point in the history
  • Loading branch information
nnethercote committed Dec 9, 2021
1 parent f5d9f1d commit e9f1d13
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,11 @@
//! #[global_allocator]
//! static ALLOC: dhat::Alloc = dhat::Alloc;
//!
//! # // Trickiness: `#[test]` is needed in a test, but messes things up here.
//! # // So we comment it out in a way that will make it show up in the docs.
//! # /*
//! #[test]
//! # */
//! fn test1() {
//! let _profiler = dhat::ProfilerBuilder::new().testing().build();
//!
Expand All @@ -255,6 +259,7 @@
//! dhat::assert_eq!(stats.curr_blocks, 1);
//! dhat::assert_eq!(stats.curr_bytes, 16);
//! }
//! # test1()
//! ```
//! The [`testing`](ProfilerBuilder::testing) call puts the profiler into
//! testing mode, which allows the stats provided by [`HeapStats::get`] to be
Expand Down

0 comments on commit e9f1d13

Please sign in to comment.