mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-14 10:43:50 +00:00
CPArray mutableCopy.
This commit is contained in:
1 parent
2a3b9e13c3
commit
0a9c9741e8
2 files changed
+24
-1
No files matched your search
@@ -397,6 +397,17 @@
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPArray (CPMutableCopying)
|
||||
|
||||
- (id)mutableCopy
|
||||
{
|
||||
var r = [CPMutableArray new];
|
||||
[r addObjectsFromArray:self];
|
||||
return r;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var selectorCompare = function selectorCompare(object1, object2, selector)
|
||||
{
|
||||
return [object1 performSelector:selector withObject:object2];
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
@import <Foundation/Foundation.j>
|
||||
@import "CPArrayTest.j"
|
||||
|
||||
|
||||
@implementation CPMutableArrayTest : CPArrayTest
|
||||
|
||||
+ (Class)arrayClass
|
||||
@@ -448,6 +447,19 @@
|
||||
[self assert:[5, 4, 4, 3, 2, 2, 1, 1, 1, 1] equals:target];
|
||||
}
|
||||
|
||||
- (void)testMutableCopy
|
||||
{
|
||||
var normalArray = [CPArray array];
|
||||
|
||||
[self assertThrows:function () { [array addObject:[CPNull null]] }];
|
||||
|
||||
var mutableArray = [normalArray mutableCopy];
|
||||
|
||||
[mutableArray addObject:[CPNull null]];
|
||||
|
||||
[self assert:1 equals:[mutableArray count] message:"mutable copy should have content"];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPPrettyObject : CPObject
|
||||
|
||||
Reference in new issue
Block a user