From dc7aa8e0f2200614da0e4352532ef7aaaeac695b Mon Sep 17 00:00:00 2001 From: David Koloski Date: Wed, 18 May 2022 14:23:52 -0400 Subject: [PATCH] tests: move unexported macro doctest into unit test (#616) Nightly has begun running doctests for unexported macros as of https://github.com/rust-lang/rust/pull/96630, which caused a doctest for test_unpack_octets_4 which was previously ignored to be run. This broke the CI because macros that are not exported with `#[macro_export]` cannot be used from external crates (and thus cannot be doctested). This change ignores the doctest and copies the relevant code into a unit test. Co-authored-by: David Koloski --- src/frame/mod.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/frame/mod.rs b/src/frame/mod.rs index 5a682b634..570a162a8 100644 --- a/src/frame/mod.rs +++ b/src/frame/mod.rs @@ -11,7 +11,8 @@ use std::fmt; /// /// # Examples /// -/// ```rust +/// ```ignore +/// # // We ignore this doctest because the macro is not exported. /// let buf: [u8; 4] = [0, 0, 0, 1]; /// assert_eq!(1u32, unpack_octets_4!(buf, 0, u32)); /// ``` @@ -25,6 +26,15 @@ macro_rules! unpack_octets_4 { }; } +#[cfg(test)] +mod tests { + #[test] + fn test_unpack_octets_4() { + let buf: [u8; 4] = [0, 0, 0, 1]; + assert_eq!(1u32, unpack_octets_4!(buf, 0, u32)); + } +} + mod data; mod go_away; mod head;