Differences From Artifact [4cefe879e1]:
- File
tests/OFJSONTests.m
— part of check-in
[44f45c2e35]
at
2017-01-09 17:36:36
on branch trunk
— Update copyright
Forgot to add 2017, even though I already did quite some changes in
2017. (user: js, size: 2337) [annotate] [blame] [check-ins using]
To Artifact [0d2731c6ad]:
- File
tests/OFJSONTests.m
— part of check-in
[cfd54bd090]
at
2017-05-01 13:51:41
on branch trunk
— Add tests for generic OF(Mutable)Dictionary
These are usually not used, as OFDictionary_hashtable and
OFMutableDictionary_hashtable are used instead. However, they are used
if someone creates their own subclass of OFDictionary /
OFMutableDictionary. As they are rarely used in production, it is
important to run all tests on them. (user: js, size: 2337) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
42 43 44 45 46 47 48 | [OFNumber numberWithInt: 0xF], [OFNull null], @"foo", [OFNumber numberWithBool: false], nil], nil]; | | | | | | | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | [OFNumber numberWithInt: 0xF], [OFNull null], @"foo", [OFNumber numberWithBool: false], nil], nil]; TEST(@"-[JSONValue] #1", [[s JSONValue] isEqual: d]) TEST(@"-[JSONRepresentation]", [[d JSONRepresentation] isEqual: @"{\"x\":[0.5,15,null,\"foo\",false],\"foo\":\"b\\na\\r\"}"]) TEST(@"OF_JSON_REPRESENTATION_PRETTY", [[d JSONRepresentationWithOptions: OF_JSON_REPRESENTATION_PRETTY] isEqual: @"{\n\t\"x\": [\n\t\t0.5,\n\t\t15,\n\t\tnull,\n\t\t" @"\"foo\",\n\t\tfalse\n\t],\n\t\"foo\": \"b\\na\\r\"\n}"]) TEST(@"OF_JSON_REPRESENTATION_JSON5", [[d JSONRepresentationWithOptions: OF_JSON_REPRESENTATION_JSON5] isEqual: @"{x:[0.5,15,null,\"foo\",false],foo:\"b\\\na\\r\"}"]) EXPECT_EXCEPTION(@"-[JSONValue] #2", OFInvalidJSONException, [@"{" JSONValue]) EXPECT_EXCEPTION(@"-[JSONValue] #3", OFInvalidJSONException, [@"]" JSONValue]) EXPECT_EXCEPTION(@"-[JSONValue] #4", OFInvalidJSONException, [@"bar" JSONValue]) EXPECT_EXCEPTION(@"-[JSONValue] #5", OFInvalidJSONException, [@"[\"a\" \"b\"]" JSONValue]) [pool drain]; } @end |