Skip to content

Commit 3c45b5a

Browse files
Ignore encoding case in assert_xml_eq
This fixes flaky tests where encoding is either `utf-8` or `UTF-8`.
1 parent 925a4e8 commit 3c45b5a

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

schema/src/tests/utils.rs

+21-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
1+
use xml::reader::XmlEvent;
2+
13
pub fn assert_xml_eq(actual: &str, expected: &str) {
24
for (a, e) in without_whitespaces(actual).zip(without_whitespaces(expected)) {
3-
assert_eq!(a, e);
5+
match (a, e) {
6+
(
7+
Ok(XmlEvent::StartDocument {
8+
version,
9+
encoding,
10+
standalone,
11+
}),
12+
Ok(XmlEvent::StartDocument {
13+
version: version_expected,
14+
encoding: encoding_expected,
15+
standalone: standalone_expected,
16+
}),
17+
) => {
18+
assert_eq!(version, version_expected);
19+
assert_eq!(encoding.to_lowercase(), encoding_expected.to_lowercase());
20+
assert_eq!(standalone, standalone_expected);
21+
}
22+
(a, e) => assert_eq!(a, e),
23+
}
424
}
525
}
626

0 commit comments

Comments
 (0)