Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
test-newer-libxml2:
strategy:
matrix:
libxml_version: ["2.12.9", "2.13.8","2.14.1"]
libxml_version: ["2.12.9", "2.13.8", "2.14.1", "2.15.1"]
name: With libxml ${{ matrix.libxml_version }}
runs-on: ubuntu-latest
steps:
Expand All @@ -58,4 +58,4 @@ jobs:
with:
command: test
env:
LD_LIBRARY_PATH: /usr/local/lib
LD_LIBRARY_PATH: /usr/local/lib
14 changes: 12 additions & 2 deletions tests/base_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,12 @@ fn serialization_as_html() {
assert!(source_result.is_ok());
let source_file = source_result.unwrap();

let result = std::fs::read_to_string("tests/resources/as_html_result.xml");
let result_legacy = std::fs::read_to_string("tests/resources/as_html_result.xml");
assert!(result_legacy.is_ok());
let result_file_legacy = result_legacy.unwrap();

// From libxml2 2.15 on, the result is different:
let result = std::fs::read_to_string("tests/resources/as_html_result_2.15.xml");
assert!(result.is_ok());
let result_file = result.unwrap();

Expand All @@ -279,5 +284,10 @@ fn serialization_as_html() {

let doc_str = doc.to_string_with_options(options);

assert_eq!(strip_whitespace(&result_file), strip_whitespace(&doc_str));
let doc_without_whitespace = strip_whitespace(&doc_str);
assert!(
doc_without_whitespace != strip_whitespace(&result_file)
|| doc_without_whitespace != strip_whitespace(&result_file_legacy),
"Serialization as HTML of the source XML document is:\n\n{doc_str}\n\nExpected one of:\n\n{result_file}\n\nor\n\n{result_file_legacy}\n"
);
}
11 changes: 11 additions & 0 deletions tests/resources/as_html_result_2.15.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<html>
<head><meta charset="UTF-8">
<title>Page Title</title>
</head>
<body>

<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

</body>
</html>
Loading