Fix execute_xpath() to return an NSError when expression can't be evaluated; Remove previous attributes when setting attributes; Add related tests

This commit is contained in:
Doug Simons 2024-05-14 15:25:07 -06:00 committed by GitHub
parent 3f994d3ee1
commit 50f447f5b8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 81 additions and 3 deletions

View file

@ -43,7 +43,15 @@ int main()
NSInternalInconsistencyException,
"cannot add attributes to multiple parents");
[root1 setAttributes:@[attr2]];
PASS_EQUAL([root1 attributeForName: @"attr2"], attr2,
"setAttributes: added the new attribute");
PASS_EQUAL([root1 attributeForName: @"attr1"], nil,
"setAttributes: removed the old attribute");
PASS_EQUAL([root1 attributes], @[attr2], "attributes are just as set");
[root1 setAttributes:@[]];
PASS_EQUAL([root1 attributes], @[], "setAttributes:@[] removes all attributes");
[root1 release];
[root2 release];