Updated test and fix for gh issue #539

This commit is contained in:
Alan Rogers
2010-03-28 15:04:41 -07:00
committed by Francisco Ryan Tolmasky I
parent 564399c78b
commit d5cea283d4
2 changed files with 10 additions and 4 deletions
+7 -1
View File
@@ -153,8 +153,14 @@
continue;
var value = object[key];
if (value == null)
{
[dictionary setObject:[CPNull null] forKey:key];
continue;
}
if (recursively && value != null)
if (recursively)
{
if (value.constructor === Object)
value = [CPDictionary dictionaryWithJSObject:value recursively:YES];
+3 -3
View File
@@ -67,9 +67,9 @@
- (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];
[self assert:3 equals:[dict count]];
[self assert:[@"key1", @"key2", @"key3"] equals:[dict allKeys]];
[self assert:[CPNull null] equals:[dict objectForKey:@"key3"]];
}
- (void)testDictionaryWithJSObjectNonRecursive