---
 Test/PropertyAttributeTest2.m | 55 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 53 insertions(+), 2 deletions(-)

diff --git a/Test/PropertyAttributeTest2.m b/Test/PropertyAttributeTest2.m
index ebf1632..6995045 100644
--- a/Test/PropertyAttributeTest2.m
+++ b/Test/PropertyAttributeTest2.m
@@ -282,7 +282,7 @@ static void testPropertyForProperty(objc_property_t p,
     printf("attributes for '%s': %s, should be: %s\n", name, attrs, types);
 	assert(strcmp(types, attrs) == 0);
 	unsigned int attrsCount = 0;
-	objc_property_attribute_t* attrsList = property_copyAttributeList(p, &attrsCount);
+	objc_property_attribute_t *attrsList = property_copyAttributeList(p, &attrsCount);
 	assert(0 != attrsList);
     printf("attributes list size for '%s': %u, should be: %u\n", name, attrsCount, size);
     assert(attrsCount == size);
@@ -296,6 +296,13 @@ static void testPropertyForProperty(objc_property_t p,
         }
         assert(found);
     }
+	free(attrsList);
+	attrsList = property_copyAttributeList(p, NULL);
+	assert(0 != attrsList);
+	objc_property_attribute_t *ra;
+	for (attrsCount = 0, ra = attrsList; ra->name != NULL; attrsCount++, ra++) {}
+    assert(attrsCount == size);
+	free(attrsList);
     for (unsigned int index=0; index<size; index++) {
         const char* value = property_copyAttributeValue(p, list[index].name);
         assert(0 != value);
@@ -363,6 +370,50 @@ static void testAddPropertyForClass(Class testClass)
 																	   ATTR("D", ""),
 																	   ATTR("V", "backingIvar")));
 
+    assert(class_addProperty(testClass, "addProperty4", ATTRS(ATTR("T", "@"),
+															  ATTR("R", ""),
+															  ATTR("&", ""),
+															  ATTR("C", ""),
+															  ATTR("W", ""),
+															  ATTR("D", ""),
+															  ATTR("V", "backingIvar"))));
+	testPropertyForProperty(class_getProperty(testClass, "addProperty4"),
+							"addProperty4", "T@,R,&,C,W,D,VbackingIvar", ATTRS(ATTR("T", "@"),
+																			   ATTR("R", ""),
+																			   ATTR("&", ""),
+																			   ATTR("C", ""),
+																			   ATTR("W", ""),
+																			   ATTR("D", ""),
+																			   ATTR("V", "backingIvar")));
+
+    assert(class_addProperty(testClass, "addProperty5", ATTRS(ATTR("T", "@"),
+															  ATTR("D", ""),
+															  ATTR("W", ""),
+															  ATTR("C", ""),
+															  ATTR("&", ""),
+															  ATTR("R", ""),
+															  ATTR("V", "backingIvar"))));
+	// The only concession to MacOS X is that we reorder the attributes string
+#if __APPLE__
+	testPropertyForProperty(class_getProperty(testClass, "addProperty5"),
+							"addProperty5", "T@,D,W,C,&,R,VbackingIvar", ATTRS(ATTR("T", "@"),
+																			   ATTR("R", ""),
+																			   ATTR("&", ""),
+																			   ATTR("C", ""),
+																			   ATTR("W", ""),
+																			   ATTR("D", ""),
+																			   ATTR("V", "backingIvar")));
+#else
+	testPropertyForProperty(class_getProperty(testClass, "addProperty5"),
+							"addProperty5", "T@,R,&,C,W,D,VbackingIvar", ATTRS(ATTR("T", "@"),
+																			   ATTR("R", ""),
+																			   ATTR("&", ""),
+																			   ATTR("C", ""),
+																			   ATTR("W", ""),
+																			   ATTR("D", ""),
+																			   ATTR("V", "backingIvar")));
+#endif
+
     assert(class_addProperty(testClass, "replaceProperty", ATTRS(ATTR("T", "@"))));
 	testPropertyForProperty(class_getProperty(testClass, "replaceProperty"),
 							"replaceProperty", "T@", ATTRS(ATTR("T", "@")));
@@ -432,7 +483,7 @@ void structDefault2Setter(id self, SEL _cmd, struct YorkshireTeaStruct* value) {
 
 int main(void)
 {
-#if !__has_feature(objc_property_clean_abi)
+#if !__APPLE__  && !__has_feature(objc_property_clean_abi)
 	// report failure because most of these tests will failed
 	return 1;
 #else
_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to