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

Side by Side Diff: tests/corelib_2/splay_tree_from_iterable_test.dart

Issue 2983383002: Migrated test block 26 to Dart 2.0. (Closed)
Patch Set: Updated splay_tree_from_iterables_test to not check for checked mode, and updated status files acco… Created 3 years, 4 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
« no previous file with comments | « tests/corelib_2/sort_test.dart ('k') | tests/corelib_2/splay_tree_from_iterables_test.dart » ('j') | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'dart:collection'; 6 import 'dart:collection';
7 7
8 main() { 8 main() {
9 defaultFunctionValuesTest(); 9 defaultFunctionValuesTest();
10 defaultKeyFunctionTest(); 10 defaultKeyFunctionTest();
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 // Make sure it is not just SplayTreeMap<dynamic, dynamic>. 117 // Make sure it is not just SplayTreeMap<dynamic, dynamic>.
118 Expect.isFalse(map is SplayTreeMap<String, dynamic>); 118 Expect.isFalse(map is SplayTreeMap<String, dynamic>);
119 Expect.isFalse(map is SplayTreeMap<dynamic, int>); 119 Expect.isFalse(map is SplayTreeMap<dynamic, int>);
120 } 120 }
121 121
122 typedef String intToString(int v); 122 typedef String intToString(int v);
123 typedef bool intToBool(int v); 123 typedef bool intToBool(int v);
124 124
125 // Test in checked mode with explicitly given types. 125 // Test in checked mode with explicitly given types.
126 void typedTest() { 126 void typedTest() {
127 bool isCheckedMode = false;
128 assert((isCheckedMode = true));
129 if (!isCheckedMode) return;
130
131 // Assign functions to typed function variables. 127 // Assign functions to typed function variables.
132 intToString key = (int v) => "$v"; 128 intToString key = (int v) => "$v";
133 intToBool value = (int v) => v.isOdd; 129 intToBool value = (int v) => v.isOdd;
134 Function id = (int i) => i; 130 Function id = (int i) => i;
135 131
136 Expect.throws(() { 132 Expect.throws(() {
137 new SplayTreeMap<String, bool>.fromIterable(<int>[1, 2, 3], key: key 133 new SplayTreeMap<String, bool>.fromIterable(<int>[1, 2, 3], key: key
138 // No "value" map, defaults to identity, which returns int, not bool. 134 // No "value" map, defaults to identity, which returns int, not bool.
139 ); 135 );
140 }); 136 });
(...skipping 22 matching lines...) Expand all
163 key: key, value: value); 159 key: key, value: value);
164 Iterable<String> keys = map.keys; 160 Iterable<String> keys = map.keys;
165 Iterable<bool> values = map.values; 161 Iterable<bool> values = map.values;
166 List<String> keyList = keys.toList(); 162 List<String> keyList = keys.toList();
167 List<bool> valueList = values.toList(); 163 List<bool> valueList = values.toList();
168 Expect.equals(3, keyList.length); 164 Expect.equals(3, keyList.length);
169 Expect.equals(3, valueList.length); 165 Expect.equals(3, valueList.length);
170 Expect.equals(keys.first, map.firstKey()); 166 Expect.equals(keys.first, map.firstKey());
171 Expect.equals(keys.last, map.lastKey()); 167 Expect.equals(keys.last, map.lastKey());
172 } 168 }
OLDNEW
« no previous file with comments | « tests/corelib_2/sort_test.dart ('k') | tests/corelib_2/splay_tree_from_iterables_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698