Skip to content

Commit df16f79

Browse files
Mingundralley
authored andcommitted
Move concrete check! invocations to the corresponding modules
1 parent ab6d52e commit df16f79

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/reader/buffered_reader.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,11 @@ impl<'b, R: BufRead> XmlSource<'b, &'b mut Vec<u8>> for R {
429429

430430
#[cfg(test)]
431431
mod test {
432+
use crate::reader::test::check;
433+
use crate::reader::XmlSource;
434+
435+
check!(&mut Vec::new());
436+
432437
#[cfg(feature = "encoding")]
433438
mod encoding {
434439
use crate::events::Event;

src/reader/mod.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -932,6 +932,7 @@ pub(crate) fn is_whitespace(b: u8) -> bool {
932932

933933
#[cfg(test)]
934934
mod test {
935+
/// Checks the internal implementation of the various reader methods
935936
macro_rules! check {
936937
($buf:expr) => {
937938
mod read_bytes_until {
@@ -1804,17 +1805,8 @@ mod test {
18041805
};
18051806
}
18061807

1807-
/// Tests for reader that generates events that borrow from the provided buffer
1808-
mod buffered {
1809-
use crate::reader::XmlSource;
1810-
1811-
check!(&mut Vec::new());
1812-
}
1813-
1814-
/// Tests for reader that generates events that borrow from the input
1815-
mod borrowed {
1816-
use crate::reader::XmlSource;
1817-
1818-
check!(());
1819-
}
1808+
// Export a macro for the child modules:
1809+
// - buffered_reader
1810+
// - slice_reader
1811+
pub(super) use check;
18201812
}

src/reader/slice_reader.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ impl<'a> XmlSource<'a, ()> for &'a [u8] {
232232

233233
#[cfg(test)]
234234
mod test {
235+
use crate::reader::test::check;
236+
use crate::reader::XmlSource;
237+
238+
check!(());
235239

236240
#[cfg(feature = "encoding")]
237241
mod encoding {

0 commit comments

Comments
 (0)