Index: src/OFArray.m ================================================================== --- src/OFArray.m +++ src/OFArray.m @@ -397,17 +397,20 @@ - (OFString*)description { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFMutableString *ret; - ret = [[self componentsJoinedByString: @", "] mutableCopy]; + ret = [[self componentsJoinedByString: @",\n"] mutableCopy]; @try { - [ret prependString: @"("]; - [ret appendString: @")"]; + [ret prependString: @"(\n"]; + [ret replaceOccurrencesOfString: @"\n" + withString: @"\n\t"]; + [ret appendString: @"\n)"]; } @catch (id e) { [ret release]; + @throw e; } [pool release]; [ret autorelease]; Index: src/OFDictionary.m ================================================================== --- src/OFDictionary.m +++ src/OFDictionary.m @@ -703,11 +703,11 @@ return hash; } - (OFString*)description { - OFMutableString *ret = [OFMutableString stringWithString: @"{"]; + OFMutableString *ret = [OFMutableString stringWithString: @"{\n"]; OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init], *pool2; OFEnumerator *enumerator = [self keyEnumerator]; id key; size_t i; @@ -718,15 +718,17 @@ [ret appendString: [key description]]; [ret appendString: @" = "]; [ret appendString: [[self objectForKey: key] description]]; if (++i < count) - [ret appendString: @"; "]; + [ret appendString: @";\n"]; [pool2 releaseObjects]; } - [ret appendString: @"}"]; + [ret replaceOccurrencesOfString: @"\n" + withString: @"\n\t"]; + [ret appendString: @";\n}"]; [pool release]; /* * Class swizzle the string to be immutable. We declared the return type Index: src/OFList.m ================================================================== --- src/OFList.m +++ src/OFList.m @@ -294,26 +294,28 @@ return hash; } - (OFString*)description { - OFMutableString *ret = [OFMutableString stringWithString: @"["]; + OFMutableString *ret = [OFMutableString stringWithString: @"[\n"]; OFAutoreleasePool *pool; of_list_object_t *iter; pool = [[OFAutoreleasePool alloc] init]; for (iter = firstListObject; iter != NULL; iter = iter->next) { [ret appendString: [iter->object description]]; if (iter->next != NULL) - [ret appendString: @", "]; + [ret appendString: @",\n"]; [pool releaseObjects]; } - [ret appendString: @"]"]; + [ret replaceOccurrencesOfString: @"\n" + withString: @"\n\t"]; + [ret appendString: @"\n]"]; [pool release]; /* * Class swizzle the string to be immutable. We declared the return type Index: tests/OFArrayTests.m ================================================================== --- tests/OFArrayTests.m +++ tests/OFArrayTests.m @@ -55,11 +55,11 @@ (a[2] = [OFArray arrayWithCArray: c_ary length: 3]) && [a[2] isEqual: a[1]]) TEST(@"-[description]", - [[a[0] description ]isEqual: @"(Foo, Bar, Baz)"]) + [[a[0] description ]isEqual: @"(\n\tFoo,\n\tBar,\n\tBaz\n)"]) TEST(@"-[addObject:]", R([m[0] addObject: c_ary[0]]) && R([m[0] addObject: c_ary[2]])) TEST(@"-[addObject:atIndex:]", R([m[0] addObject: c_ary[1] @@ -262,28 +262,28 @@ case 1: return @"bar"; } return nil; - }]) && [[m[0] description] isEqual: @"(foo, bar)"]) + }]) && [[m[0] description] isEqual: @"(\n\tfoo,\n\tbar\n)"]) TEST(@"-[mappedArrayUsingBLock]", [[[m[0] mappedArrayUsingBlock: ^ id (id obj, size_t idx) { - switch (idx) { - case 0: + switch (idx) { + case 0: return @"foobar"; case 1: return @"qux"; } return nil; - }] description] isEqual: @"(foobar, qux)"]) + }] description] isEqual: @"(\n\tfoobar,\n\tqux\n)"]) TEST(@"-[filteredArrayUsingBlock:]", [[[m[0] filteredArrayUsingBlock: ^ BOOL (id obj, size_t idx) { return ([obj isEqual: @"foo"] ? YES : NO); - }] description] isEqual: @"(foo)"]) + }] description] isEqual: @"(\n\tfoo\n)"]) #endif [pool drain]; } @end Index: tests/OFDictionaryTests.m ================================================================== --- tests/OFDictionaryTests.m +++ tests/OFDictionaryTests.m @@ -61,11 +61,12 @@ [dict containsObjectIdenticalTo: values[0]] == YES && [dict containsObjectIdenticalTo: [OFString stringWithString: values[0]]] == NO) TEST(@"-[description]", - [[dict description] isEqual: @"{key1 = value1; key2 = value2}"]) + [[dict description] isEqual: + @"{\n\tkey1 = value1;\n\tkey2 = value2;\n}"]) TEST(@"-[keyEnumerator]", (key_enum = [dict keyEnumerator])) TEST(@"-[objectEnumerator]", (obj_enum = [dict objectEnumerator])) TEST(@"OFEnumerator's -[nextObject]", @@ -165,16 +166,16 @@ return @"val1"; if ([key isEqual: keys[1]]) return @"val2"; return nil; - }] description] isEqual: @"{key1 = val1; key2 = val2}"]) + }] description] isEqual: @"{\n\tkey1 = val1;\n\tkey2 = val2;\n}"]) TEST(@"-[filteredDictionaryUsingBlock:]", [[[dict filteredDictionaryUsingBlock: ^ BOOL (id key, id obj) { return ([key isEqual: keys[0]] ? YES : NO); - }] description] isEqual: @"{key1 = value_1}"]) + }] description] isEqual: @"{\n\tkey1 = value_1;\n}"]) #endif TEST(@"-[count]", [dict count] == 2) TEST(@"+[dictionaryWithKeysAndObjects:]", Index: tests/OFListTests.m ================================================================== --- tests/OFListTests.m +++ tests/OFListTests.m @@ -93,11 +93,11 @@ [[list lastListObject]->object isEqual: strings[2]]) TEST(@"-[isEqual:]", [list isEqual: [[list copy] autorelease]]) TEST(@"-[description]", - [[list description] isEqual: @"[Foo, Bar, Baz]"]) + [[list description] isEqual: @"[\n\tFoo,\n\tBar,\n\tBaz\n]"]) TEST(@"-[objectEnumerator]", (enumerator = [list objectEnumerator])) loe = [list firstListObject]; i = 0;