diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 4dfb329e8..ef3d2965e 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -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: @@ -58,4 +58,4 @@ jobs: with: command: test env: - LD_LIBRARY_PATH: /usr/local/lib \ No newline at end of file + LD_LIBRARY_PATH: /usr/local/lib diff --git a/tests/base_tests.rs b/tests/base_tests.rs index 78f2a9838..b8dd66e5f 100644 --- a/tests/base_tests.rs +++ b/tests/base_tests.rs @@ -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(); @@ -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" + ); } diff --git a/tests/resources/as_html_result_2.15.xml b/tests/resources/as_html_result_2.15.xml new file mode 100644 index 000000000..0fc1b3f76 --- /dev/null +++ b/tests/resources/as_html_result_2.15.xml @@ -0,0 +1,11 @@ + + +Page Title + + + +

This is a Heading

+

This is a paragraph.

+ + +