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

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

Issue 12086062: Rename mappedBy to map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Undo change to test-script. Created 7 years, 10 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
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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 expect(m2.name, "2"); 634 expect(m2.name, "2");
635 expect(m3.name, "3"); 635 expect(m3.name, "3");
636 expect(m2.parent, m1); 636 expect(m2.parent, m1);
637 expect(m3.parent, m1); 637 expect(m3.parent, m1);
638 expect(m1.parent, isNull); 638 expect(m1.parent, isNull);
639 } 639 }
640 640
641 /** Extract the state from [object] using the rules in [s] and return it. */ 641 /** Extract the state from [object] using the rules in [s] and return it. */
642 states(object, Serialization s) { 642 states(object, Serialization s) {
643 var rules = s.rulesFor(object, null); 643 var rules = s.rulesFor(object, null);
644 return rules.mappedBy((x) => x.extractState(object, doNothing)).toList(); 644 return rules.map((x) => x.extractState(object, doNothing)).toList();
645 } 645 }
646 646
647 /** A hard-coded rule for serializing Node instances. */ 647 /** A hard-coded rule for serializing Node instances. */
648 class NodeRule extends CustomRule { 648 class NodeRule extends CustomRule {
649 bool appliesTo(instance, _) => instance.runtimeType == Node; 649 bool appliesTo(instance, _) => instance.runtimeType == Node;
650 getState(instance) => [instance.parent, instance.name, instance.children]; 650 getState(instance) => [instance.parent, instance.name, instance.children];
651 create(state) => new Node(state[1]); 651 create(state) => new Node(state[1]);
652 setState(Node node, state) { 652 setState(Node node, state) {
653 node.parent = state[0]; 653 node.parent = state[0];
654 node.children = state[2]; 654 node.children = state[2];
655 } 655 }
656 } 656 }
OLDNEW
« no previous file with comments | « pkg/serialization/lib/src/serialization_rule.dart ('k') | pkg/unittest/lib/compact_vm_config.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698