ObjFW  Diff

Differences From Artifact [f8cccb7ff5]:

To Artifact [527ae62e46]:


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
65
66
67
68
69
#import "OFURL.h"
#import "OFAutoreleasePool.h"
#import "OFXMLElement.h"

#import "TestsAppDelegate.h"

static OFString *module = @"OFSerialization";
static const OFString *expected = @"<?xml version='1.0' encoding='UTF-8'?>\n"
    @"<serialization xmlns='https://webkeks.org/objfw/serialization'>"
    @"<object class='OFMutableDictionary'><pair><key><object class='OFArray'>"
    @"<object class='OFString'>Qu&quot;xbar\ntest</object>"
    @"<object class='OFNumber' type='signed'>1234</object>"
    @"<object class='OFMutableString'>asd</object>"
    @"<object class='OFDate'><seconds>1234</seconds>"
    @"<microseconds>5678</microseconds></object></object></key><value>"
    @"<object class='OFString'>Hello</object></value></pair><pair><key>"
    @"<object class='OFString'>Blub</object></key><value>"
    @"<object class='OFString'>B&quot;la</object></value></pair><pair><key>"
    @"<object class='OFList'><object class='OFString'>Hello</object>"
    @"<object class='OFString'>Wo&#xD;ld!\nHow are you?</object>"
    @"<object class='OFURL'>https://webkeks.org/</object>"
    @"<object class='OFXMLElement'><name>x</name><namespaces>"
    @"<object class='OFMutableDictionary'><pair><key>"
    @"<object class='OFString'>http://www.w3.org/2000/xmlns/</object></key>"
    @"<value><object class='OFString'>xmlns</object></value></pair><pair><key>"
    @"<object class='OFString'>http://www.w3.org/XML/1998/namespace</object>"
    @"</key><value><object class='OFString'>xml</object></value></pair>"
    @"</object></namespaces><children><object class='OFMutableArray'>"
    @"<object class='OFXMLElement'><name>y</name><namespaces>"
    @"<object class='OFMutableDictionary'><pair><key><object class='OFString'>"
    @"http://www.w3.org/2000/xmlns/</object></key><value>"
    @"<object class='OFString'>xmlns</object></value></pair><pair><key>"
    @"<object class='OFString'>http://www.w3.org/XML/1998/namespace</object>"
    @"</key><value><object class='OFString'>xml</object></value></pair>"
    @"</object></namespaces></object></object></children></object></object>"
    @"</key><value><object class='OFString'>list</object></value></pair>"
    @"</object></serialization>";

@implementation TestsAppDelegate (SerializationTests)
- (void)serializationTests
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFMutableDictionary *d = [OFMutableDictionary dictionary];
	OFMutableArray *a = [OFMutableArray array];







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







26
27
28
29
30
31
32






























33
34
35
36
37
38
39
#import "OFURL.h"
#import "OFAutoreleasePool.h"
#import "OFXMLElement.h"

#import "TestsAppDelegate.h"

static OFString *module = @"OFSerialization";































@implementation TestsAppDelegate (SerializationTests)
- (void)serializationTests
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFMutableDictionary *d = [OFMutableDictionary dictionary];
	OFMutableArray *a = [OFMutableArray array];
86
87
88
89
90
91
92
93

94
95
96
97
98
99
100
	[l appendObject: [OFURL URLWithString: @"https://webkeks.org/"]];
	[l appendObject: [OFXMLElement elementWithXMLString: @"<x><y/></x>"]];

	[d setObject: @"list"
	      forKey: l];

	TEST(@"-[stringBySerializing]",
	    (s = [d stringBySerializing]) && [s isEqual: expected])


	TEST(@"-[objectByDeserializing]",
	    [[s objectByDeserializing] isEqual: d])

	[pool drain];
}
@end







|
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
	[l appendObject: [OFURL URLWithString: @"https://webkeks.org/"]];
	[l appendObject: [OFXMLElement elementWithXMLString: @"<x><y/></x>"]];

	[d setObject: @"list"
	      forKey: l];

	TEST(@"-[stringBySerializing]",
	    (s = [d stringBySerializing]) && [s isEqual:
	    [OFString stringWithContentsOfFile: @"serialization.xml"]])

	TEST(@"-[objectByDeserializing]",
	    [[s objectByDeserializing] isEqual: d])

	[pool drain];
}
@end