mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-10-03 15:46:16 +00:00
Adding a unit test to verify fix to +[CPDictionary dictionaryWithJSObject:(JSObject)object recursively:(BOOL)recursively]
This commit is contained in:
committed by
Ross Boucher
parent
7aa1ae6bd4
commit
c8f3445fa6
@@ -16,6 +16,12 @@
|
||||
|
||||
string_dict = [[CPDictionary alloc] initWithObjects:[@"1", @"2"] forKeys:[@"key1", @"key2"]];
|
||||
json_dict = [CPDictionary dictionaryWithJSObject:json recursively:YES];
|
||||
|
||||
json_with_nulls = {
|
||||
"key1": ['1', '2', '3'],
|
||||
"key2": "This is a string",
|
||||
"key3": null
|
||||
}
|
||||
}
|
||||
|
||||
- (void)testInitWithDictionary
|
||||
@@ -58,6 +64,14 @@
|
||||
[self assert:[[dict objectForKey:@"key3"] count] equals:1];
|
||||
}
|
||||
|
||||
- (void)testDictionaryWithJSObjectRecursiveWithNull
|
||||
{
|
||||
var dict = [CPDictionary dictionaryWithJSObject:json_with_nulls recursively:YES];
|
||||
[self assert:2 equals:[dict count]];
|
||||
[self assert:[@"key1", @"key2"] equals:[dict allKeys]];
|
||||
[self assert:[dict objectForKey:@"key3"] equals:nil];
|
||||
}
|
||||
|
||||
- (void)testDictionaryWithJSObjectNonRecursive
|
||||
{
|
||||
var non_recursive_dict = [CPDictionary dictionaryWithJSObject:json recursively:NO];
|
||||
|
||||
Reference in New Issue
Block a user