From ff2890d91b18e5d2b5e8ea546636a261a051ead2 Mon Sep 17 00:00:00 2001 From: Tom Parker-Shemilt Date: Sat, 30 Dec 2023 23:19:47 +0000 Subject: [PATCH] Update docs for mod-level functionality --- README.md | 2 ++ serial_test/src/lib.rs | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/README.md b/README.md index 43efca1..545443f 100644 --- a/README.md +++ b/README.md @@ -33,6 +33,8 @@ For cases like doctests and integration tests where the tests are run as separat similar properties but based off file locking. Note that there are no guarantees about one test with `serial` and another with `file_serial` as they lock using different methods. +All of the attributes can also be applied at a `mod` level and will be automagically applied to all test functions in that block. + ## Usage The minimum supported Rust version here is 1.68.2. Note this is minimum _supported_, as it may well compile with lower versions, but they're not supported at all. Upgrades to this will require at a major version bump. 1.x supports 1.51 if you need a lower version than that. diff --git a/serial_test/src/lib.rs b/serial_test/src/lib.rs index 641a8b7..d6519f0 100644 --- a/serial_test/src/lib.rs +++ b/serial_test/src/lib.rs @@ -42,6 +42,23 @@ //! } //! ```` //! +//! All of the attributes can also be applied at a `mod` level and will be automagically applied to all test functions in that block +//! ```` +//! #[cfg(test)] +//! #[serial] +//! mod serial_attr_tests { +//! fn foo() { +//! // Won't have `serial` applied, because not a test function +//! println!("Nothing"); +//! } +//! +//! #[test] +//! fn test_bar() { +//! // Will be run serially +//! } +//!} +//! ```` +//! //! ## Feature flags #![cfg_attr( feature = "docsrs",