Skip to content

Commit

Permalink
tests: udate JSON tests
Browse files Browse the repository at this point in the history
Signed-off-by: Alexis Laferrière <[email protected]>
  • Loading branch information
xymus committed Aug 30, 2016
1 parent 78e07de commit c4e2aac
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion tests/sav/test_json_deserialization_plain.res
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
# Nit: <MyClass i:123 s:hello f:123.456 a:[one, two] o:<null>>

# JSON: {"__class": "MyClass", "i": 123, "s": "hello", "f": 123.456, "a": ["one", "two"]}
# Errors: 'Deserialization Error: JSON object has not attribute 'o'.'
# Nit: <MyClass i:123 s:hello f:123.456 a:[one, two] o:<null>>

# JSON: {"__class": "MyClass", "i": 123, "s": "hello", "f": 123.456, "a": ["one", "two"], "o":
Expand Down
2 changes: 1 addition & 1 deletion tests/sav/test_json_deserialization_plain_alt2.res
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Runtime error: Uninitialized attribute _s (alt/test_json_deserialization_plain_alt2.nit:22)
# JSON: {"__class": "MyClass", "i": 123, "o": null}
# Errors: 'Deserialization Error: JSON object has not attribute 's'.', 'Deserialization Error: Wrong type on `MyClass::s` expected `String`, got `null`', 'Deserialization Error: JSON object has not attribute 'f'.', 'Deserialization Error: Wrong type on `MyClass::f` expected `Float`, got `null`', 'Deserialization Error: JSON object has not attribute 'a'.', 'Deserialization Error: Wrong type on `MyClass::a` expected `Array[String]`, got `null`'
# Errors: 'Deserialization Error: attribute `MyClass::s` missing from JSON object', 'Deserialization Error: attribute `MyClass::f` missing from JSON object', 'Deserialization Error: attribute `MyClass::a` missing from JSON object'
2 changes: 1 addition & 1 deletion tests/test_json_deserialization_plain.nit
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ tests.add """
tests.add """
{"__class": "MyClass", "i": 123, "s": "hello", "f": 123.456, "o": null, "a": ["one", "two"], "Some random attribute": 777}"""

# Skipping `o` will cause an error but the attribute will be set to `null`
# Skipping `o` will set the attribute to `null`
tests.add """
{"__class": "MyClass", "i": 123, "s": "hello", "f": 123.456, "a": ["one", "two"]}"""

Expand Down

0 comments on commit c4e2aac

Please sign in to comment.