Mercurial > projects > orange
comparison tests/Typedef.d @ 40:02dbd18b7fe9
Moved all tests into its own modules.
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sat, 06 Aug 2011 13:27:21 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
39:301476d40518 | 40:02dbd18b7fe9 |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2011 Jacob Carlborg. All rights reserved. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 6, 2011 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module tests.Typedef; | |
8 | |
9 import orange.core.string; | |
10 import orange.serialization.Serializer; | |
11 import orange.serialization.archives.XMLArchive; | |
12 import orange.test.UnitTester; | |
13 import tests.Util; | |
14 | |
15 Serializer serializer; | |
16 XMLArchive!(char) archive; | |
17 | |
18 typedef int Int; | |
19 | |
20 class I | |
21 { | |
22 Int a; | |
23 } | |
24 | |
25 I i; | |
26 | |
27 unittest | |
28 { | |
29 archive = new XMLArchive!(char); | |
30 serializer = new Serializer(archive); | |
31 | |
32 i = new I; | |
33 i.a = 1; | |
34 | |
35 describe("serialize typedef") in { | |
36 it("should return a serialized typedef") in { | |
37 serializer.reset(); | |
38 serializer.serialize(i); | |
39 assert(archive.data().containsDefaultXmlContent()); | |
40 assert(archive.data().containsXmlTag("object", `runtimeType="tests.Typedef.I" type="I" key="0" id="0"`)); | |
41 assert(archive.data().containsXmlTag("typedef", `type="Int" key="a" id="2"`)); | |
42 assert(archive.data().containsXmlTag("int", `key="1" id="3"`, "1")); | |
43 }; | |
44 }; | |
45 | |
46 // describe("deserialize typedef") in { | |
47 // it("should return a deserialized typedef equal to the original typedef") in { | |
48 // auto iDeserialized = serializer.deserialize!(I)(archive.untypedData); | |
49 // assert(i.a == iDeserialized.a); | |
50 // }; | |
51 // }; | |
52 } |