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

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

Issue 2683403003: Improve error message in flaky test (Closed)
Patch Set: Created 3 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
« no previous file with comments | « no previous file | 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 import "dart:typed_data"; 7 import "dart:typed_data";
8 8
9 main() { 9 main() {
10 var intTest = new Test<int>(); 10 var intTest = new Test<int>();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 throws("fillRange", () { list.fillRange(0, 1, null); }); 100 throws("fillRange", () { list.fillRange(0, 1, null); });
101 101
102 success(opName, op(list)) { 102 success(opName, op(list)) {
103 var expect; 103 var expect;
104 try { 104 try {
105 expect = op(elements); 105 expect = op(elements);
106 } catch (e) { 106 } catch (e) {
107 try { 107 try {
108 op(list); 108 op(list);
109 } catch (e2) { 109 } catch (e2) {
110 Expect.equals(e.runtimeType, e2.runtimeType); 110 Expect.equals(e.runtimeType, e2.runtimeType,
111 "$name :: $opName threw different exceptions: "
112 "${e.runtimeType} vs ${e2.runtimeType}");
111 return; 113 return;
112 } 114 }
113 Expect.fail("$name-$opName didn't throw, expected: $e"); 115 Expect.fail("$name-$opName didn't throw, expected: $e");
114 } 116 }
115 var actual = op(list); 117 var actual = op(list);
116 checkElements(); 118 checkElements();
117 if (expect is List) { 119 if (expect is List) {
118 Expect.listEquals(expect, actual, "$name-$opName"); 120 Expect.listEquals(expect, actual, "$name-$opName");
119 } else if (expect is Iterable) { 121 } else if (expect is Iterable) {
120 Expect.isTrue(actual is Iterable); 122 Expect.isTrue(actual is Iterable);
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } 238 }
237 createCodeUnits(n) { 239 createCodeUnits(n) {
238 var string = new String.fromCharCodes(new Iterable.generate(n)); 240 var string = new String.fromCharCodes(new Iterable.generate(n));
239 return string.codeUnits; 241 return string.codeUnits;
240 } 242 }
241 createTypedList(n) { 243 createTypedList(n) {
242 var tl = new Uint8List(n); 244 var tl = new Uint8List(n);
243 for (int i = 0; i < n; i++) tl[i] = i; 245 for (int i = 0; i < n; i++) tl[i] = i;
244 return tl; 246 return tl;
245 } 247 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698