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
66 changes: 66 additions & 0 deletions libxml2/_test.pony
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,72 @@ actor \nodoc\ Main is TestList
test(TestParseDocNoBlanks)
test(TestParseDocErrorRecovery)
test(TestParseDocEntitiesNotSubstitutedByDefault)
// Extensive API coverage
test(TestSetRootElementReplacesOldRoot)
test(TestCreateDocWithCustomVersion)
test(TestSetPropOverwritesExisting)
test(TestEmptyAttributeValue)
test(TestUnicodeContentRoundTrip)
test(TestUnicodeAttributeValues)
test(TestSerializeUTF16Encoding)
test(TestParserOptionsCombined)
test(TestXPathStringFunctionsExtensive)
test(TestXPathPositionAndLast)
test(TestXPathNameFunctions)
test(TestManyAttributesRoundTrip)
test(Property1UnitTest[(String, String)](
recover iso PropSetGetPropRoundTrip end))
test(Property1UnitTest[USize](
recover iso PropAppendChildPreservesCount end))
// Extensive API coverage (batch 2)
test(TestXPathAxes)
test(TestXPathNumberFunctions)
test(TestXPathBooleanFunctions)
test(TestXPathAttributePredicates)
test(TestCDATAContentPreserved)
test(TestSelfClosingEquivalence)
test(TestCommentRoundTrip)
test(TestSetContentReplacesChildren)
test(TestSetUnsetGetPropEmpty)
test(TestLongNamesAndValues)
test(TestGetLangNestedScopes)
test(TestSaveToFileWithFormatAndEncoding)
test(Property1UnitTest[Array[String]](
recover iso PropStructuralRoundTripStable end))
test(Property1UnitTest[USize](
recover iso PropGetPropsCardinality end))
test(Property1UnitTest[(String, String)](
recover iso PropSetUnsetIsEmpty end))
// Extensive API coverage (batch 3)
test(TestAppendChildPreservesOrder)
test(TestDoctypeParsing)
test(TestEmptyDocumentVariants)
test(TestXPathOnDocWithoutRoot)
test(TestLoadDtdFlagsAcceptValidInput)
test(TestPedanticAcceptsValidInput)
test(TestDeepXPathExpression)
test(TestXmlSpaceAttributePreserved)
test(TestNamespacePrefixShadowing)
test(TestFromPTRRejectsNull)
// Extensive API coverage (batch 4: primitive sweeps + edges
// + error-field reads + remaining property-based)
test(TestAllXml2ErrorDomainPrimitives)
test(TestAllXml2ErrorLevelPrimitives)
test(TestAllXPathTypePrimitives)
test(TestCreateTextNodeEntityChars)
test(TestCreateCommentEdgeCases)
test(TestSetPropEmptyValue)
test(TestGetContentMixedChildren)
test(TestAddChildWithContent)
test(TestCommentsFilteredFromGetChildren)
test(TestSerializeUnsupportedEncoding)
test(TestXPathErrorFields)
test(TestParseFileMissingFile)
test(TestParseErrorFieldsAreAccessible)
test(Property1UnitTest[String](
recover iso PropElementNameRoundTrip end))
test(Property1UnitTest[USize](
recover iso PropMultiplePropsAllRetrievable end))
// Crash-resistance fuzz tests (PonyCheck Property1)
test(Property1UnitTest[String](recover iso FuzzParseDoc end))
test(Property1UnitTest[(String, String)](
Expand Down
11 changes: 8 additions & 3 deletions libxml2/_tests/coverage_tests.pony
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,15 @@ class \nodoc\ iso TestNodeUtilityMethods is UnitTest
// The string cast includes all text content from the node tree
h.assert_eq[String]("\n hello\n world\n", cast_str)

// Test getLineNo on root (returns 0 unless globally enabled)
// Test getLineNo on root. libxml2 returns -1 when line
// tracking is unavailable, otherwise a non-negative line
// number. Either is acceptable; what matters is the return
// value is in the documented range.
let line_no = root.getLineNo()
// Just verify the method runs and returns a value
h.assert_true(true) // Method executed without error
h.assert_true(
line_no >= I64(-1),
"getLineNo should return -1 (unavailable) or >= 0; got "
+ line_no.string())

// Test these methods on child nodes
let children = root.getChildren()
Expand Down
Loading
Loading