@@ -53,12 +53,11 @@ } return self; } -- (instancetype)initWithKey: (id)key - arguments: (va_list)arguments +- (instancetype)initWithKey: (id)key arguments: (va_list)arguments { self = [super init]; @try { _dictionary = [[OFMutableDictionary alloc] @@ -119,17 +118,15 @@ { if (self == [SimpleMutableDictionary class]) [self inheritMethodsFromClass: [SimpleDictionary class]]; } -- (void)setObject: (id)object - forKey: (id)key +- (void)setObject: (id)object forKey: (id)key { bool existed = ([_dictionary objectForKey: key] == nil); - [_dictionary setObject: object - forKey: key]; + [_dictionary setObject: object forKey: key]; if (existed) _mutations++; } @@ -165,14 +162,12 @@ OFMutableDictionary *mutDict = [mutableDictionaryClass dictionary]; OFDictionary *dict; OFEnumerator *keyEnumerator, *objectEnumerator; OFArray *keysArray, *valuesArray; - [mutDict setObject: values[0] - forKey: keys[0]]; - [mutDict setValue: values[1] - forKey: keys[1]]; + [mutDict setObject: values[0] forKey: keys[0]]; + [mutDict setValue: values[1] forKey: keys[1]]; TEST(@"-[objectForKey:]", [[mutDict objectForKey: keys[0]] isEqual: values[0]] && [[mutDict objectForKey: keys[1]] isEqual: values[1]] && [mutDict objectForKey: @"key3"] == nil) @@ -182,12 +177,11 @@ [[mutDict valueForKey: @"@count"] isEqual: [OFNumber numberWithInt: 2]]) EXPECT_EXCEPTION(@"Catching -[setValue:forKey:] on immutable " @"dictionary", OFUndefinedKeyException, - [[dictionaryClass dictionary] setValue: @"x" - forKey: @"x"]) + [[dictionaryClass dictionary] setValue: @"x" forKey: @"x"]) TEST(@"-[containsObject:]", [mutDict containsObject: values[0]] && ![mutDict containsObject: @"nonexistent"]) @@ -223,12 +217,11 @@ [mutDict removeObjectForKey: keys[0]]; EXPECT_EXCEPTION(@"Detection of mutation during enumeration", OFEnumerationMutationException, [keyEnumerator nextObject]); - [mutDict setObject: values[0] - forKey: keys[0]]; + [mutDict setObject: values[0] forKey: keys[0]]; size_t i = 0; bool ok = true; for (OFString *key in mutDict) { @@ -235,24 +228,21 @@ if (i > 1 || ![key isEqual: keys[i]]) { ok = false; break; } - [mutDict setObject: [mutDict objectForKey: key] - forKey: key]; + [mutDict setObject: [mutDict objectForKey: key] forKey: key]; i++; } TEST(@"Fast Enumeration", ok) ok = false; @try { for (OFString *key in mutDict) { (void)key; - - [mutDict setObject: @"" - forKey: @""]; + [mutDict setObject: @"" forKey: @""]; } } @catch (OFEnumerationMutationException *e) { ok = true; } @@ -359,29 +349,25 @@ TEST(@"-[mutableCopy]", (mutDict = [[dict mutableCopy] autorelease]) && mutDict.count == dict.count && [[mutDict objectForKey: keys[0]] isEqual: values[0]] && [[mutDict objectForKey: keys[1]] isEqual: values[1]] && - R([mutDict setObject: @"value3" - forKey: @"key3"]) && + R([mutDict setObject: @"value3" forKey: @"key3"]) && [[mutDict objectForKey: @"key3"] isEqual: @"value3"] && [[mutDict objectForKey: keys[0]] isEqual: values[0]] && - R([mutDict setObject: @"foo" - forKey: keys[0]]) && + R([mutDict setObject: @"foo" forKey: keys[0]]) && [[mutDict objectForKey: keys[0]] isEqual: @"foo"]) TEST(@"-[removeObjectForKey:]", R([mutDict removeObjectForKey: keys[0]]) && [mutDict objectForKey: keys[0]] == nil) - [mutDict setObject: @"foo" - forKey: keys[0]]; + [mutDict setObject: @"foo" forKey: keys[0]]; TEST(@"-[isEqual:]", ![mutDict isEqual: dict] && R([mutDict removeObjectForKey: @"key3"]) && ![mutDict isEqual: dict] && - R([mutDict setObject: values[0] - forKey: keys[0]]) && + R([mutDict setObject: values[0] forKey: keys[0]]) && [mutDict isEqual: dict]) objc_autoreleasePoolPop(pool); }