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

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

Issue 2879153005: Add support to dart2js for option --enable-asserts. (Closed)
Patch Set: Added !$checked to section predicate in co19 status file Created 3 years, 5 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
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 Expect.isTrue(map is Map<int, String>); 114 Expect.isTrue(map is Map<int, String>);
115 Expect.isTrue(map is SplayTreeMap<int, String>); 115 Expect.isTrue(map is SplayTreeMap<int, String>);
116 116
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 // Test in checked mode with explicitly given types. 122 // Test in checked mode with explicitly given types.
123 void typedTest() { 123 void typedTest() {
124 bool isCheckedMode = false; 124 if (!typeAssertionsEnabled) return;
125 assert((isCheckedMode = true));
126 if (!isCheckedMode) return;
127 125
128 // Assign functions to untyped function variables. 126 // Assign functions to untyped function variables.
129 Function key = (int v) => "$v"; 127 Function key = (int v) => "$v";
130 Function value = (int v) => v.isOdd; 128 Function value = (int v) => v.isOdd;
131 Function id = (int i) => i; 129 Function id = (int i) => i;
132 130
133 Expect.throws(() { 131 Expect.throws(() {
134 new SplayTreeMap<String, bool>.fromIterable(<int>[1, 2, 3], key: key 132 new SplayTreeMap<String, bool>.fromIterable(<int>[1, 2, 3], key: key
135 // No "value" map, defaults to identity, which returns int, not bool. 133 // No "value" map, defaults to identity, which returns int, not bool.
136 ); 134 );
(...skipping 23 matching lines...) Expand all
160 key: key, value: value); 158 key: key, value: value);
161 Iterable<String> keys = map.keys; 159 Iterable<String> keys = map.keys;
162 Iterable<bool> values = map.values; 160 Iterable<bool> values = map.values;
163 List<String> keyList = keys.toList(); 161 List<String> keyList = keys.toList();
164 List<bool> valueList = values.toList(); 162 List<bool> valueList = values.toList();
165 Expect.equals(3, keyList.length); 163 Expect.equals(3, keyList.length);
166 Expect.equals(3, valueList.length); 164 Expect.equals(3, valueList.length);
167 Expect.equals(keys.first, map.firstKey()); 165 Expect.equals(keys.first, map.firstKey());
168 Expect.equals(keys.last, map.lastKey()); 166 Expect.equals(keys.last, map.lastKey());
169 } 167 }
OLDNEW
« no previous file with comments | « tests/corelib/list_removeat_test.dart ('k') | tests/language/function_type/function_type0_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698