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

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

Issue 12282038: Remove deprecated string features. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 }); 147 });
148 148
149 test('Iteration helpers', () { 149 test('Iteration helpers', () {
150 var map = {"a" : 1, "b" : 2, "c" : 3}; 150 var map = {"a" : 1, "b" : 2, "c" : 3};
151 var list = [1, 2, 3]; 151 var list = [1, 2, 3];
152 var set = new Set.from(list); 152 var set = new Set.from(list);
153 var m = keysAndValues(map); 153 var m = keysAndValues(map);
154 var l = keysAndValues(list); 154 var l = keysAndValues(list);
155 var s = keysAndValues(set); 155 var s = keysAndValues(set);
156 156
157 m.forEach((key, value) {expect(key.charCodes[0], value + 96);}); 157 m.forEach((key, value) {expect(key.codeUnits[0], value + 96);});
158 l.forEach((key, value) {expect(key + 1, value);}); 158 l.forEach((key, value) {expect(key + 1, value);});
159 var index = 0; 159 var index = 0;
160 var seen = new Set(); 160 var seen = new Set();
161 s.forEach((key, value) { 161 s.forEach((key, value) {
162 expect(key, index++); 162 expect(key, index++);
163 expect(seen.contains(value), isFalse); 163 expect(seen.contains(value), isFalse);
164 seen.add(value); 164 seen.add(value);
165 }); 165 });
166 expect(seen.length, 3); 166 expect(seen.length, 3);
167 167
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
739 } 739 }
740 findValue(String key, Map state) { 740 findValue(String key, Map state) {
741 var answer; 741 var answer;
742 for (var each in state.keys) { 742 for (var each in state.keys) {
743 var value = state[each]; 743 var value = state[each];
744 if (value == key) return each; 744 if (value == key) return each;
745 } 745 }
746 return null; 746 return null;
747 } 747 }
748 } 748 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698