Skip to content

Commit

Permalink
tests: move unexported macro doctest into unit test (#616)
Browse files Browse the repository at this point in the history
Nightly has begun running doctests for unexported macros as of
rust-lang/rust#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 <[email protected]>
  • Loading branch information
djkoloski and David Koloski authored May 18, 2022
1 parent 3a0c622 commit dc7aa8e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/frame/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
/// ```
Expand All @@ -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;
Expand Down

0 comments on commit dc7aa8e

Please sign in to comment.