Skip to content

Commit 1bd6b3d

Browse files
committed
Test: Add a complex field to KitchenSink
1 parent 657663d commit 1bd6b3d

File tree

3 files changed

+55
-4
lines changed

3 files changed

+55
-4
lines changed

test/json_serializable_integration_test.dart

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ void main() {
114114
'map',
115115
'stringStringMap',
116116
'stringIntMap',
117-
'stringDateTimeMap'
117+
'stringDateTimeMap',
118+
'crazyComplex'
118119
];
119120

120121
expect(json.keys, orderedEquals(expectedOrder));
@@ -128,6 +129,28 @@ void main() {
128129

129130
roundTripItem(item);
130131
});
132+
133+
test('complex nested type', () {
134+
var item = new KitchenSink()
135+
..crazyComplex = [
136+
null,
137+
{},
138+
{
139+
"null": null,
140+
"empty": {},
141+
"items": {
142+
"null": null,
143+
"empty": [],
144+
"items": [
145+
null,
146+
[],
147+
[new DateTime.now()]
148+
]
149+
}
150+
}
151+
];
152+
roundTripItem(item);
153+
});
131154
});
132155
}
133156

test/test_files/json_test_example.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,17 @@ class KitchenSink extends Object with _$KitchenSinkSerializerMixin {
5858
Map<String, int> stringIntMap;
5959
Map<String, DateTime> stringDateTimeMap;
6060

61+
List<Map<String, Map<String, List<List<DateTime>>>>> crazyComplex;
62+
6163
//TODO(kevmoo) - finish this...
6264
bool operator ==(Object other) =>
6365
other is KitchenSink &&
6466
_deepEquals(iterable, other.iterable) &&
6567
_deepEquals(dynamicIterable, other.dynamicIterable) &&
6668
_deepEquals(dateTimeIterable, other.dateTimeIterable) &&
6769
_deepEquals(dateTimeList, other.dateTimeList) &&
68-
_deepEquals(stringDateTimeMap, other.stringDateTimeMap);
70+
_deepEquals(stringDateTimeMap, other.stringDateTimeMap) &&
71+
_deepEquals(crazyComplex, other.crazyComplex);
6972
}
7073

7174
@JsonSerializable()

test/test_files/json_test_example.g.dart

Lines changed: 27 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)