Skip to content

Commit 90be3ee

Browse files
authored
Merge pull request #454 from Mingun/fix-gitattributes
Fix #443: Keep LF eol for all test documents, explicitly mark encoding for UTF-16 documents
2 parents ad27240 + 0596d67 commit 90be3ee

File tree

3 files changed

+7
-16
lines changed

3 files changed

+7
-16
lines changed

.gitattributes

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
# Unit tests assume that all xml files have unix style line endings
2-
*.xml text eol=cr
2+
/tests/documents/* text eol=lf
3+
4+
/tests/documents/utf16be.xml binary
5+
/tests/documents/utf16le.xml binary
6+
/tests/documents/sample_5_utf16bom.xml binary

Changelog.md

+2
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@
190190
- [#407]: Improved benchmark suite to cover whole-document parsing, escaping and unescaping text
191191
- [#418]: Parameterized macrobenchmarks and comparative benchmarks, added throughput measurements via criterion
192192
- [#434]: Added more tests for serde deserializer
193+
- [#443]: Now all documents in `/tests/documents` are checked out with LF eol in working copy (except sample_5_utf16bom.xml)
193194

194195
[#8]: https://github.com/Mingun/fast-xml/pull/8
195196
[#9]: https://github.com/Mingun/fast-xml/pull/9
@@ -216,6 +217,7 @@
216217
[#437]: https://github.com/tafia/quick-xml/pull/437
217218
[#439]: https://github.com/tafia/quick-xml/pull/439
218219
[#440]: https://github.com/tafia/quick-xml/pull/440
220+
[#443]: https://github.com/tafia/quick-xml/pull/443
219221

220222

221223
## 0.23.0 -- 2022-05-08

tests/unit_tests.rs

-15
Original file line numberDiff line numberDiff line change
@@ -235,10 +235,6 @@ fn test_writer_borrow() -> Result<()> {
235235
#[test]
236236
fn test_writer_indent() -> Result<()> {
237237
let txt = include_str!("../tests/documents/test_writer_indent.xml");
238-
// Normalize newlines on Windows to just \n, which is what the reader and
239-
// writer use.
240-
let normalized_txt = txt.replace("\r\n", "\n");
241-
let txt = normalized_txt.as_str();
242238
let mut reader = Reader::from_str(txt);
243239
reader.trim_text(true);
244240
let mut writer = Writer::new_with_indent(Cursor::new(Vec::new()), b' ', 4);
@@ -250,12 +246,6 @@ fn test_writer_indent() -> Result<()> {
250246
}
251247

252248
let result = writer.into_inner().into_inner();
253-
// println!("{:?}", String::from_utf8_lossy(&result));
254-
255-
#[cfg(windows)]
256-
assert!(result.into_iter().eq(txt.bytes().filter(|b| *b != 13)));
257-
258-
#[cfg(not(windows))]
259249
assert_eq!(result, txt.as_bytes());
260250

261251
Ok(())
@@ -275,11 +265,6 @@ fn test_writer_indent_cdata() -> Result<()> {
275265
}
276266

277267
let result = writer.into_inner().into_inner();
278-
279-
#[cfg(windows)]
280-
assert!(result.into_iter().eq(txt.bytes().filter(|b| *b != 13)));
281-
282-
#[cfg(not(windows))]
283268
assert_eq!(result, txt.as_bytes());
284269

285270
Ok(())

0 commit comments

Comments
 (0)