3a3aec0959f4bd72afbf8254bff25f55cdae7635
[nit.git] / tests / sav / nitce / test_json_deserialization_alt3.res
1 # Nit:
2 <A: true a 0.123 1234 asdf false p4ssw0rd>
3
4 # Json:
5 {
6         "__kind": "obj", "__id": 0, "__class": "A",
7         "b": true,
8         "c": {"__kind": "char", "__val": "a"},
9         "f": 0.123,
10         "i": 1234,
11         "serialization_specific_name": "asdf",
12         "n": null
13 }
14
15 # Back in Nit:
16 <A: true a 0.123 1234 asdf false p4ssw0rd>
17
18 # Nit:
19 <B: <A: false b 123.123 2345 hjkl true p4ssw0rd> 1111 qwer>
20
21 # Json:
22 {
23         "__kind": "obj", "__id": 0, "__class": "B",
24         "b": false,
25         "c": {"__kind": "char", "__val": "b"},
26         "f": 123.123,
27         "i": 2345,
28         "serialization_specific_name": "hjkl",
29         "n": 12,
30         "ii": 1111,
31         "ss": "qwer"
32 }
33
34 # Back in Nit:
35 <B: <A: false b 123.123 2345 hjkl true p4ssw0rd> 1111 qwer>
36
37 # Nit:
38 <C: <A: true a 0.123 1234 asdf false p4ssw0rd> <B: <A: false b 123.123 2345 hjkl true p4ssw0rd> 1111 qwer>>
39
40 # Json:
41 {
42         "__kind": "obj", "__id": 0, "__class": "C",
43         "a": {
44                 "__kind": "obj", "__id": 1, "__class": "A",
45                 "b": true,
46                 "c": {"__kind": "char", "__val": "a"},
47                 "f": 0.123,
48                 "i": 1234,
49                 "serialization_specific_name": "asdf",
50                 "n": null
51         },
52         "b": {
53                 "__kind": "obj", "__id": 2, "__class": "B",
54                 "b": false,
55                 "c": {"__kind": "char", "__val": "b"},
56                 "f": 123.123,
57                 "i": 2345,
58                 "serialization_specific_name": "hjkl",
59                 "n": 12,
60                 "ii": 1111,
61                 "ss": "qwer"
62         },
63         "aa": {
64                 "__kind": "ref", "__id": 1
65         }
66 }
67
68 # Back in Nit:
69 <C: <A: true a 0.123 1234 asdf false p4ssw0rd> <B: <A: false b 123.123 2345 hjkl true p4ssw0rd> 1111 qwer>>
70
71 # Nit:
72 <D: <B: <A: false b 123.123 2345 new line ->
73 <- false p4ssw0rd> 1111         f"\r\/> true>
74
75 # Json:
76 {
77         "__kind": "obj", "__id": 0, "__class": "D",
78         "b": false,
79         "c": {"__kind": "char", "__val": "b"},
80         "f": 123.123,
81         "i": 2345,
82         "serialization_specific_name": "new line ->\n<-",
83         "n": null,
84         "ii": 1111,
85         "ss": "\tf\"\r\\/",
86         "d": {
87                 "__kind": "ref", "__id": 0
88         }
89 }
90
91 # Back in Nit:
92 <D: <B: <A: false b 123.123 2345 new line ->
93 <- false p4ssw0rd> 1111         f"\r\/> true>
94
95 # Nit:
96 <E: a: hello, 1234, 123.4; b: hella, 2345, 234.5>
97
98 # Json:
99 {
100         "__kind": "obj", "__id": 0, "__class": "E",
101         "a": {
102                 "__kind": "obj", "__id": 1, "__class": "Array",
103                 "__items": [
104                         "hello",
105                         1234,
106                         123.4
107                 ]
108         },
109         "b": {
110                 "__kind": "obj", "__id": 2, "__class": "Array",
111                 "__items": [
112                         "hella",
113                         2345,
114                         234.5
115                 ]
116         }
117 }
118
119 # Back in Nit:
120 <E: a: hello, 1234, 123.4; b: hella, 2345, 234.5>
121
122 Deserialization Error: Doesn't know how to deserialize class "Array"
123 Deserialization Error: Wrong type on `E::a` expected `Array[Object]`, got `null`
124 Deserialization Error: Doesn't know how to deserialize class "Array"
125 Deserialization Error: Wrong type on `E::b` expected `Array[nullable Serializable]`, got `null`
126 # Nit:
127 <E: 2222>
128
129 # Json:
130 {
131         "__kind": "obj", "__id": 0, "__class": "F",
132         "n": 2222
133 }
134
135 # Back in Nit:
136 null
137
138 Deserialization Error: Doesn't know how to deserialize class "F"
139 # Nit:
140 <E: 33.33>
141
142 # Json:
143 {
144         "__kind": "obj", "__id": 0, "__class": "F",
145         "n": 33.33
146 }
147
148 # Back in Nit:
149 null
150
151 Deserialization Error: Doesn't know how to deserialize class "F"
152 # Nit:
153 <G: hs: -1, 0; s: one, two; hm: one. 1, two. 2; am: three. 3, four. 4>
154
155 # Json:
156 {
157         "__kind": "obj", "__id": 0, "__class": "G",
158         "hs": {
159                 "__kind": "obj", "__id": 1, "__class": "HashSet",
160                 "__items": [
161                         -1,
162                         0
163                 ]
164         },
165         "s": {
166                 "__kind": "obj", "__id": 2, "__class": "ArraySet",
167                 "__items": [
168                         "one",
169                         "two"
170                 ]
171         },
172         "hm": {
173                 "__kind": "obj", "__id": 3, "__class": "HashMap", "__length": 2,
174                 "__keys": [
175                         "one",
176                         "two"
177                 ],
178                 "__values": [
179                         1,
180                         2
181                 ]
182         },
183         "am": {
184                 "__kind": "obj", "__id": 4, "__class": "ArrayMap", "__length": 2,
185                 "__keys": [
186                         "three",
187                         "four"
188                 ],
189                 "__values": [
190                         "3",
191                         "4"
192                 ]
193         }
194 }
195
196 # Back in Nit:
197 <G: hs: ; s: ; hm: ; am: >
198
199 Deserialization Error: Doesn't know how to deserialize class "HashSet"
200 Deserialization Error: Wrong type on `G::hs` expected `HashSet[Int]`, got `null`
201 Deserialization Error: Doesn't know how to deserialize class "ArraySet"
202 Deserialization Error: Wrong type on `G::s` expected `Set[String]`, got `null`
203 Deserialization Error: Doesn't know how to deserialize class "HashMap"
204 Deserialization Error: Wrong type on `G::hm` expected `HashMap[String, Int]`, got `null`
205 Deserialization Error: Doesn't know how to deserialize class "ArrayMap"
206 Deserialization Error: Wrong type on `G::am` expected `ArrayMap[String, String]`, got `null`