lib: Fix serialization issue with string-oriented typing
[nit.git] / tests / sav / test_json_deserialization_plain.res
1 # JSON: {"__kind": "obj", "__id": 0, "__class": "MyClass", "i": 123, "s": "hello", "f": 123.456, "a": ["one", "two"], "o": null}
2 # Nit: <MyClass i:123 s:hello f:123.456 a:[one, two] o:<null>>
3
4 # JSON: {"__class": "MyClass", "i": 123, "s": "hello", "f": 123.456, "a": ["one", "two"], "o": null}
5 # Nit: <MyClass i:123 s:hello f:123.456 a:[one, two] o:<null>>
6
7 # JSON: {"s": "hello", "o": null, "i": 123, "f": 123.456, "__class": "MyClass", "a": ["one", "two"]}
8 # Nit: <MyClass i:123 s:hello f:123.456 a:[one, two] o:<null>>
9
10 # JSON: {"__class": "MyClass", "i": 123, "s": "hello", "f": 123.456, "o": null, "a": ["one", "two"], "Some random attribute": 777}
11 # Nit: <MyClass i:123 s:hello f:123.456 a:[one, two] o:<null>>
12
13 # JSON: {"__class": "MyClass", "i": 123, "s": "hello", "f": 123.456, "a": ["one", "two"]}
14 # Errors: 'Deserialization Error: JSON object has not attribute 'o'.'
15 # Nit: <MyClass i:123 s:hello f:123.456 a:[one, two] o:<null>>
16
17 # JSON: {"__class": "MyClass", "i": 123, "s": "hello", "f": 123.456, "a": ["one", "two"], "o":
18         {"__class": "MyClass", "i": 456, "s": "world", "f": 654.321, "a": ["1", "2"], "o": null}}
19 # Nit: <MyClass i:123 s:hello f:123.456 a:[one, two] o:<MyClass i:456 s:world f:654.321 a:[1, 2] o:<null>>>
20
21 # JSON: {"i": 123, "s": "hello", "f": 123.456, "a": ["one", "two"], "o": null}
22 # Errors: 'Serialization Error: JSON object declaration does not declare a `__class`.'
23 # Nit: <JsonObject i:123, s:hello, f:123.456, a:[one,two], o:<null>>
24
25 # JSON: {"__class": "MyClass", "i": 123, "s": "hello", "f": 123.456, "a": ["one", "two"], "o": "Not the right type"}
26 # Errors: 'Deserialization Error: Wrong type on `MyClass::o` expected `nullable MyClass`, got `ASCIIFlatString`'
27 # Nit: <MyClass i:123 s:hello f:123.456 a:[one, two] o:<null>>
28
29 # JSON: not valid json
30 # Errors: 'Error Parsing JSON: [1:1-1:2] Unexpected character 'n'; is acceptable instead: value'
31 # Nit: null
32