Skip to content

Commit ab6d52e

Browse files
Mingundralley
authored andcommitted
Remove sync-only trait XmlSource from the check! macro
That change will allow us to reuse `check!` macro for testing async code
1 parent 838b8d4 commit ab6d52e

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/reader/mod.rs

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ mod test {
935935
macro_rules! check {
936936
($buf:expr) => {
937937
mod read_bytes_until {
938-
use crate::reader::XmlSource;
938+
use super::*;
939939
// Use Bytes for printing bytes as strings for ASCII range
940940
use crate::utils::Bytes;
941941
use pretty_assertions::assert_eq;
@@ -1039,10 +1039,13 @@ mod test {
10391039
}
10401040

10411041
mod read_bang_element {
1042+
use super::*;
1043+
10421044
/// Checks that reading CDATA content works correctly
10431045
mod cdata {
1046+
use super::*;
10441047
use crate::errors::Error;
1045-
use crate::reader::{BangType, XmlSource};
1048+
use crate::reader::BangType;
10461049
use crate::utils::Bytes;
10471050
use pretty_assertions::assert_eq;
10481051

@@ -1143,8 +1146,9 @@ mod test {
11431146
///
11441147
/// [specification]: https://www.w3.org/TR/xml11/#dt-comment
11451148
mod comment {
1149+
use super::*;
11461150
use crate::errors::Error;
1147-
use crate::reader::{BangType, XmlSource};
1151+
use crate::reader::BangType;
11481152
use crate::utils::Bytes;
11491153
use pretty_assertions::assert_eq;
11501154

@@ -1276,9 +1280,12 @@ mod test {
12761280

12771281
/// Checks that reading DOCTYPE definition works correctly
12781282
mod doctype {
1283+
use super::*;
1284+
12791285
mod uppercase {
1286+
use super::*;
12801287
use crate::errors::Error;
1281-
use crate::reader::{BangType, XmlSource};
1288+
use crate::reader::BangType;
12821289
use crate::utils::Bytes;
12831290
use pretty_assertions::assert_eq;
12841291

@@ -1355,8 +1362,9 @@ mod test {
13551362
}
13561363

13571364
mod lowercase {
1365+
use super::*;
13581366
use crate::errors::Error;
1359-
use crate::reader::{BangType, XmlSource};
1367+
use crate::reader::BangType;
13601368
use crate::utils::Bytes;
13611369
use pretty_assertions::assert_eq;
13621370

@@ -1435,7 +1443,7 @@ mod test {
14351443
}
14361444

14371445
mod read_element {
1438-
use crate::reader::XmlSource;
1446+
use super::*;
14391447
use crate::utils::Bytes;
14401448
use pretty_assertions::assert_eq;
14411449

@@ -1452,7 +1460,7 @@ mod test {
14521460
}
14531461

14541462
mod open {
1455-
use crate::reader::XmlSource;
1463+
use super::*;
14561464
use crate::utils::Bytes;
14571465
use pretty_assertions::assert_eq;
14581466

@@ -1528,7 +1536,7 @@ mod test {
15281536
}
15291537

15301538
mod self_closed {
1531-
use crate::reader::XmlSource;
1539+
use super::*;
15321540
use crate::utils::Bytes;
15331541
use pretty_assertions::assert_eq;
15341542

@@ -1798,11 +1806,15 @@ mod test {
17981806

17991807
/// Tests for reader that generates events that borrow from the provided buffer
18001808
mod buffered {
1809+
use crate::reader::XmlSource;
1810+
18011811
check!(&mut Vec::new());
18021812
}
18031813

18041814
/// Tests for reader that generates events that borrow from the input
18051815
mod borrowed {
1816+
use crate::reader::XmlSource;
1817+
18061818
check!(());
18071819
}
18081820
}

0 commit comments

Comments
 (0)