Differences From Artifact [ae9d04304d]:
- File tests/OFJSONTests.m — part of check-in [3e028f7479] at 2012-06-04 23:36:38 on branch trunk — Allow numbers in JSON5 format. (user: js, size: 1894) [annotate] [blame] [check-ins using] [more...]
To Artifact [c4b49139b1]:
- File
tests/OFJSONTests.m
— part of check-in
[72c71c4eb2]
at
2012-06-10 16:07:33
on branch trunk
— JSON: Make it possible to get the invalid line.
This introduces OFInvalidJSONException, which has a property line to get
the line in which the parsing error occurred. (user: js, size: 1874) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
19 20 21 22 23 24 25 | #import "OFString.h" #import "OFArray.h" #import "OFDictionary.h" #import "OFNumber.h" #import "OFNull.h" #import "OFAutoreleasePool.h" | | | 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 "OFInvalidJSONException.h" #import "TestsAppDelegate.h" static OFString *module = @"OFJSON"; @implementation TestsAppDelegate (JSONTests) - (void)JSONTests |
︙ | ︙ | |||
47 48 49 50 51 52 53 | nil]; TEST(@"-[JSONValue #1]", [[s JSONValue] isEqual: d]) TEST(@"-[JSONRepresentation]", [[d JSONRepresentation] isEqual: @"{\"foo\":\"ba\\r\",\"x\":[0.5,15,null,\"foo\",false]}"]) | | | | | | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | nil]; TEST(@"-[JSONValue #1]", [[s JSONValue] isEqual: d]) TEST(@"-[JSONRepresentation]", [[d JSONRepresentation] isEqual: @"{\"foo\":\"ba\\r\",\"x\":[0.5,15,null,\"foo\",false]}"]) 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 |