Skip to content

Commit 6bfca57

Browse files
author
David Koloski
committed
Move unexported macro doctest into unit test
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.
1 parent 3a0c622 commit 6bfca57

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/frame/mod.rs

+11-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ use std::fmt;
1111
///
1212
/// # Examples
1313
///
14-
/// ```rust
14+
/// ```ignore
15+
/// # // We ignore this doctest because the macro is not exported.
1516
/// let buf: [u8; 4] = [0, 0, 0, 1];
1617
/// assert_eq!(1u32, unpack_octets_4!(buf, 0, u32));
1718
/// ```
@@ -25,6 +26,15 @@ macro_rules! unpack_octets_4 {
2526
};
2627
}
2728

29+
#[cfg(test)]
30+
mod tests {
31+
#[test]
32+
fn test_unpack_octets_4() {
33+
let buf: [u8; 4] = [0, 0, 0, 1];
34+
assert_eq!(1u32, unpack_octets_4!(buf, 0, u32));
35+
}
36+
}
37+
2838
mod data;
2939
mod go_away;
3040
mod head;

0 commit comments

Comments
 (0)