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 <dkoloski@google.com>
This commit is contained in:
@@ -11,7 +11,8 @@ use std::fmt;
|
|||||||
///
|
///
|
||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```rust
|
/// ```ignore
|
||||||
|
/// # // We ignore this doctest because the macro is not exported.
|
||||||
/// let buf: [u8; 4] = [0, 0, 0, 1];
|
/// let buf: [u8; 4] = [0, 0, 0, 1];
|
||||||
/// assert_eq!(1u32, unpack_octets_4!(buf, 0, u32));
|
/// 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 data;
|
||||||
mod go_away;
|
mod go_away;
|
||||||
mod head;
|
mod head;
|
||||||
|
|||||||
Reference in New Issue
Block a user