mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 22:51:28 +00:00
Fixed error in function CPDescriptionOfObject when a JSON object property has a null value.
The function can't handle the following JSON object: {name:null}.
Also added a test case for this.
This commit is contained in:
@@ -532,6 +532,9 @@ CPLog(@"Got some class: %@", inst);
|
||||
|
||||
function CPDescriptionOfObject(anObject)
|
||||
{
|
||||
if (!anObject)
|
||||
return String(anObject);
|
||||
|
||||
if (anObject.isa)
|
||||
{
|
||||
if ([anObject isKindOfClass:CPString])
|
||||
|
||||
@@ -50,6 +50,15 @@
|
||||
[self assertTrue:expectedReturnValue === returnValue];
|
||||
}
|
||||
|
||||
- (void)testCPDescriptionOfObject
|
||||
{
|
||||
var jSON = {"name": "Martin", "access":null},
|
||||
d = CPDescriptionOfObject(jSON);
|
||||
|
||||
[self assertTrue:d.indexOf("name:") !== -1 message:"Can't find 'name:' in description of json " + d];
|
||||
[self assertTrue:d.indexOf("access:") !== -1 message:"Can't find 'access:' in description of json " + d];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation SuperReceiver : CPObject
|
||||
|
||||
Reference in New Issue
Block a user