Skip to main content

Module testing

Module testing 

Source
Expand description

Test helpers for the XML engine.

These helpers are intentionally generic and domain-free. They centralize fixture paths, golden file comparisons, and parser/writer roundtrips so modules do not need to duplicate ad-hoc test utilities.

Structs§

RoundtripResult
Result of parsing, serializing, reparsing, and serializing again.
XmlDiff
Compact, line-oriented diff for XML golden comparisons.

Constants§

GOLDEN_DIR
Repository-relative directory for golden files.
XML_FIXTURES_DIR
Repository-relative directory for XML fixtures.

Functions§

assert_compact_roundtrip
Parses XML, serializes it compactly, reparses it, and verifies stability.
assert_compact_roundtrip_with_config
Parses XML with explicit config, serializes compactly, reparses it, and verifies stability.
assert_document_matches_golden
Serializes a document using an explicit writer configuration and compares it to a golden file.
assert_matches_golden
Reads a golden file and compares it with actual XML output.
assert_xml_eq
Panics with a compact diff when two XML strings differ.
compare_xml
Compares XML strings while allowing a single final line ending in fixtures.
golden_path
Resolves a golden file path relative to the repository root.
parse_xml_fixture
Parses a fixture from tests/fixtures/xml.
read_golden
Reads a golden file from tests/golden.
read_utf8_file
Reads a UTF-8 file and maps filesystem errors to XmlError.
read_xml_fixture
Reads an XML fixture from tests/fixtures/xml.
repo_path
Resolves a path relative to the repository root.
xml_fixture_path
Resolves an XML fixture path relative to the repository root.