Overview
Comment: | Enhance JSON tests. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
db8fae97f2add696d38da88b4dcfff45 |
User & Date: | js on 2011-12-29 14:59:12 |
Other Links: | manifest | tags |
Context
2011-12-31
| ||
18:15 | Remove a cast not required anymore. check-in: 3eae98e873 user: js tags: trunk | |
2011-12-29
| ||
14:59 | Enhance JSON tests. check-in: db8fae97f2 user: js tags: trunk | |
02:04 | Add tests for JSON. check-in: f4d994aba0 user: js tags: trunk | |
Changes
Modified tests/OFJSONTests.m from [5fec8cecc1] to [373cac5c83].
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFNumber.h" #import "OFNull.h" #import "OFAutoreleasePool.h" #import "TestsAppDelegate.h" static OFString *module = @"OFJSON"; @implementation TestsAppDelegate (JSONTests) - (void)JSONTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; | > > | > | > > > > > > > > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFNumber.h" #import "OFNull.h" #import "OFAutoreleasePool.h" #import "OFInvalidEncodingException.h" #import "TestsAppDelegate.h" static OFString *module = @"OFJSON"; @implementation TestsAppDelegate (JSONTests) - (void)JSONTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFString *s = @"{\"foo\"\t:\"bar\", \"x\":/*fooo*/ [7.5\r,null//bar\n" @",\"foo\",false]}"; OFDictionary *d = [OFDictionary dictionaryWithKeysAndObjects: @"foo", @"bar", @"x", [OFArray arrayWithObjects: [OFNumber numberWithFloat: 7.5], [OFNull null], @"foo", [OFNumber numberWithBool: NO], nil], nil]; TEST(@"-[JSONValue #1]", [[s JSONValue] isEqual: d]) TEST(@"-[JSONRepresentation]", [[d JSONRepresentation] isEqual: @"{\"foo\":\"bar\",\"x\":[7.5,null,\"foo\",false]}"]) EXPECT_EXCEPTION(@"-[JSONValue #2]", OFInvalidEncodingException, [@"{" JSONValue]) EXPECT_EXCEPTION(@"-[JSONValue #3]", OFInvalidEncodingException, [@"]" JSONValue]) EXPECT_EXCEPTION(@"-[JSONValue #4]", OFInvalidEncodingException, [@"bar" JSONValue]) EXPECT_EXCEPTION(@"-[JSONValue #5]", OFInvalidEncodingException, [@"[\"a\" \"b\"]" JSONValue]) [pool drain]; } @end |