ObjFW  Diff

Differences From Artifact [ae9d04304d]:

To Artifact [c4b49139b1]:


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 "OFInvalidEncodingException.h"

#import "TestsAppDelegate.h"

static OFString *module = @"OFJSON";

@implementation TestsAppDelegate (JSONTests)
- (void)JSONTests







|







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
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]", 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







|

|

|

|





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