diff options
author | Aleksey Kladov <[email protected]> | 2020-03-04 10:38:55 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-03-04 10:55:25 +0000 |
commit | 19115e9fabf1364fe94c21b44546aa01f380f04c (patch) | |
tree | a4986faf51c39bf9fd28a78525c9c1199f238ffa /crates/test_utils | |
parent | 437329d3f5b7bb5b703b93c75a97d349eb77d6c7 (diff) |
Support cross-crate marks
Diffstat (limited to 'crates/test_utils')
-rw-r--r-- | crates/test_utils/src/marks.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/crates/test_utils/src/marks.rs b/crates/test_utils/src/marks.rs index f8fabfaff..c3185e860 100644 --- a/crates/test_utils/src/marks.rs +++ b/crates/test_utils/src/marks.rs | |||
@@ -30,6 +30,12 @@ use std::sync::atomic::{AtomicUsize, Ordering}; | |||
30 | 30 | ||
31 | #[macro_export] | 31 | #[macro_export] |
32 | macro_rules! tested_by { | 32 | macro_rules! tested_by { |
33 | ($ident:ident; force) => {{ | ||
34 | { | ||
35 | // sic! use call-site crate | ||
36 | crate::marks::$ident.fetch_add(1, std::sync::atomic::Ordering::SeqCst); | ||
37 | } | ||
38 | }}; | ||
33 | ($ident:ident) => {{ | 39 | ($ident:ident) => {{ |
34 | #[cfg(test)] | 40 | #[cfg(test)] |
35 | { | 41 | { |
@@ -41,9 +47,12 @@ macro_rules! tested_by { | |||
41 | 47 | ||
42 | #[macro_export] | 48 | #[macro_export] |
43 | macro_rules! covers { | 49 | macro_rules! covers { |
50 | // sic! use call-site crate | ||
44 | ($ident:ident) => { | 51 | ($ident:ident) => { |
45 | // sic! use call-site crate | 52 | $crate::covers!(crate::$ident) |
46 | let _checker = $crate::marks::MarkChecker::new(&crate::marks::$ident); | 53 | }; |
54 | ($krate:ident :: $ident:ident) => { | ||
55 | let _checker = $crate::marks::MarkChecker::new(&$krate::marks::$ident); | ||
47 | }; | 56 | }; |
48 | } | 57 | } |
49 | 58 | ||
@@ -52,7 +61,7 @@ macro_rules! marks { | |||
52 | ($($ident:ident)*) => { | 61 | ($($ident:ident)*) => { |
53 | $( | 62 | $( |
54 | #[allow(bad_style)] | 63 | #[allow(bad_style)] |
55 | pub(crate) static $ident: std::sync::atomic::AtomicUsize = | 64 | pub static $ident: std::sync::atomic::AtomicUsize = |
56 | std::sync::atomic::AtomicUsize::new(0); | 65 | std::sync::atomic::AtomicUsize::new(0); |
57 | )* | 66 | )* |
58 | }; | 67 | }; |