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

Side by Side Diff: pkg/serialization/test/serialization_test.dart

Issue 14773027: Fix regression in meta-serializing rules (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Slight improvement for the case of duplicate library names 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/serialization/lib/src/serialization_rule.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library serialization_test; 5 library serialization_test;
6 6
7 import 'dart:json' as json; 7 import 'dart:json' as json;
8 import 'package:unittest/unittest.dart'; 8 import 'package:unittest/unittest.dart';
9 import 'package:serialization/serialization.dart'; 9 import 'package:serialization/serialization.dart';
10 import 'package:serialization/src/serialization_helpers.dart'; 10 import 'package:serialization/src/serialization_helpers.dart';
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 var list = w.states[1].first; 228 var list = w.states[1].first;
229 expect(w.stateForReference(rootNode[children]), list); 229 expect(w.stateForReference(rootNode[children]), list);
230 var parentNode = w.stateForReference(list[0])[parent]; 230 var parentNode = w.stateForReference(list[0])[parent];
231 expect(w.stateForReference(parentNode), rootNode); 231 expect(w.stateForReference(parentNode), rootNode);
232 }); 232 });
233 233
234 test('round-trip', () { 234 test('round-trip', () {
235 runRoundTripTest(nodeSerializerReflective); 235 runRoundTripTest(nodeSerializerReflective);
236 }); 236 });
237 237
238 test('round-trip with explicit self-description', () {
239 // We provide a setup function which, when run the second time,
240 // returns a blank serialization, to make sure it will fail
241 // the second time.
242 var s;
243 oneShotSetup(node) {
244 if (s == null) {
245 s = nodeSerializerReflective(node)..selfDescribing = true;
246 return s;
247 } else {
248 s = null;
249 return new Serialization.blank()
250 ..namedObjects['Node'] = reflect(new Node('')).type;;
251 }
252 }
253
254 runRoundTripTest(oneShotSetup);
255 });
256
238 test('round-trip ClosureRule', () { 257 test('round-trip ClosureRule', () {
239 runRoundTripTest(nodeSerializerNonReflective); 258 runRoundTripTest(nodeSerializerNonReflective);
240 }); 259 });
241 260
242 test('round-trip with essential parent', () { 261 test('round-trip with essential parent', () {
243 runRoundTripTest(nodeSerializerWithEssentialParent); 262 runRoundTripTest(nodeSerializerWithEssentialParent);
244 }); 263 });
245 264
246 test('round-trip, flat format', () { 265 test('round-trip, flat format', () {
247 runRoundTripTestFlat(nodeSerializerReflective); 266 runRoundTripTestFlat(nodeSerializerReflective);
(...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 } 774 }
756 findValue(String key, Map state) { 775 findValue(String key, Map state) {
757 var answer; 776 var answer;
758 for (var each in state.keys) { 777 for (var each in state.keys) {
759 var value = state[each]; 778 var value = state[each];
760 if (value == key) return each; 779 if (value == key) return each;
761 } 780 }
762 return null; 781 return null;
763 } 782 }
764 } 783 }
OLDNEW
« 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