Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: pkg/serialization/test/serialization_test.dart

Issue 14578008: Add a DateTimeRule to default serialization (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes from review Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/serialization/lib/src/serialization_rule.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/serialization/test/serialization_test.dart
diff --git a/pkg/serialization/test/serialization_test.dart b/pkg/serialization/test/serialization_test.dart
index eeca0857c78b935910801a7a3df7024431eaa19e..1b79206b01db12f4b218f415cc8505d7c278c58f 100644
--- a/pkg/serialization/test/serialization_test.dart
+++ b/pkg/serialization/test/serialization_test.dart
@@ -144,15 +144,14 @@ main() {
test('date', () {
var date = new DateTime.now();
- var s = new Serialization()
- ..addRuleFor(date,
- constructorFields : ["year", "month", "day", "hour", "minute",
- "second", "millisecond", "isUtc"])
- .configureForMaps();
- var state = states(date, s).first;
- expect(state["year"],date.year);
- expect(state["isUtc"],date.isUtc);
- expect(state["millisecond"], date.millisecond);
+ var utcDate = new DateTime.utc(date.year, date.month, date.day,
+ date.hour, date.minute, date.second, date.millisecond);
+ var s = new Serialization();
+ var out = s.write([date, utcDate]);
+ expect(s.selfDescribing, isTrue);
+ var input = s.read(out);
+ expect(input.first, date);
+ expect(input.last, utcDate);
});
test('Iteration helpers', () {
@@ -220,7 +219,7 @@ main() {
var w = new Writer(s, const InternalMapFormat());
w.trace = new Trace(w);
w.write(n1);
- expect(w.states.length, 6); // prims, lists, essential lists, basic, symbol
+ expect(w.states.length, 7); // prims, lists * 2, basic, symbol, date
var children = 0, name = 1, parent = 2;
var nodeRule = s.rules.firstWhere((x) => x is BasicRule);
List rootNode = w.states[nodeRule.number].where(
« no previous file with comments | « pkg/serialization/lib/src/serialization_rule.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698