File tree 3 files changed +24
-0
lines changed
Parse/Internal/Object/OperationSet
3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change 65
65
- (void )setObject : (id )anObject forKey : (id <NSCopying >)aKey ;
66
66
- (void )setObject : (id )anObject forKeyedSubscript : (id <NSCopying >)aKey ;
67
67
- (void )removeObjectForKey : (id )aKey ;
68
+ - (void )removeAllObjects ;
68
69
69
70
@end
Original file line number Diff line number Diff line change @@ -166,6 +166,11 @@ - (void)removeObjectForKey:(id)key {
166
166
self.updatedAt = [NSDate date ];
167
167
}
168
168
169
+ - (void )removeAllObjects {
170
+ [self .dictionary removeAllObjects ];
171
+ self.updatedAt = [NSDate date ];
172
+ }
173
+
169
174
// /--------------------------------------
170
175
#pragma mark - NSFastEnumeration
171
176
// /--------------------------------------
Original file line number Diff line number Diff line change @@ -103,6 +103,24 @@ - (void)testRemoveObjectForKey {
103
103
XCTAssertNotEqualObjects (date, operationSet.updatedAt );
104
104
}
105
105
106
+ - (void )testRemoveAllObjects {
107
+ PFOperationSet *operationSet = [[PFOperationSet alloc ] init ];
108
+
109
+ operationSet[@" yarr" ] = [PFSetOperation setWithValue: @" a" ];
110
+ operationSet[@" yolo" ] = [PFAddOperation addWithObjects: @[ @" b" ]];
111
+
112
+ XCTAssertNotNil (operationSet[@" yarr" ]);
113
+ XCTAssertNotNil (operationSet[@" yolo" ]);
114
+ XCTAssertEqual (operationSet.count , 2 );
115
+
116
+ NSDate *date = operationSet.updatedAt ;
117
+ [operationSet removeAllObjects ];
118
+ XCTAssertNil (operationSet[@" yarr" ]);
119
+ XCTAssertNil (operationSet[@" yolo" ]);
120
+ XCTAssertEqual (operationSet.count , 0 );
121
+ XCTAssertNotEqualObjects (date, operationSet.updatedAt );
122
+ }
123
+
106
124
- (void )testCopying {
107
125
PFOperationSet *operationSet = [[PFOperationSet alloc ] init ];
108
126
operationSet[@" yarr" ] = [PFSetOperation setWithValue: @" yolo" ];
You can’t perform that action at this time.
0 commit comments