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

Side by Side Diff: sdk/lib/core/expect.dart

Issue 12473003: Remove deprecated StringBuffer.add, addAll and addCharCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * This class is *deprecated*. 8 * This class is *deprecated*.
9 * 9 *
10 * Expect is used for tests that do not want to make use of the 10 * Expect is used for tests that do not want to make use of the
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 missingSet.removeAll(actual); 245 missingSet.removeAll(actual);
246 final extraSet = new Set.from(actual); 246 final extraSet = new Set.from(actual);
247 extraSet.removeAll(expected); 247 extraSet.removeAll(expected);
248 248
249 if (extraSet.isEmpty && missingSet.isEmpty) return; 249 if (extraSet.isEmpty && missingSet.isEmpty) return;
250 String msg = _getMessage(reason); 250 String msg = _getMessage(reason);
251 251
252 StringBuffer sb = new StringBuffer("Expect.setEquals($msg) fails"); 252 StringBuffer sb = new StringBuffer("Expect.setEquals($msg) fails");
253 // Report any missing items. 253 // Report any missing items.
254 if (!missingSet.isEmpty) { 254 if (!missingSet.isEmpty) {
255 sb.add('\nExpected collection does not contain: '); 255 sb.write('\nExpected collection does not contain: ');
256 } 256 }
257 257
258 for (final val in missingSet) { 258 for (final val in missingSet) {
259 sb.add('$val '); 259 sb.write('$val ');
260 } 260 }
261 261
262 // Report any extra items. 262 // Report any extra items.
263 if (!extraSet.isEmpty) { 263 if (!extraSet.isEmpty) {
264 sb.add('\nExpected collection should not contain: '); 264 sb.write('\nExpected collection should not contain: ');
265 } 265 }
266 266
267 for (final val in extraSet) { 267 for (final val in extraSet) {
268 sb.add('$val '); 268 sb.write('$val ');
269 } 269 }
270 _fail(sb.toString()); 270 _fail(sb.toString());
271 } 271 }
272 272
273 /** 273 /**
274 * Calls the function [f] and verifies that it throws an exception. 274 * Calls the function [f] and verifies that it throws an exception.
275 * The optional [check] function can provide additional validation 275 * The optional [check] function can provide additional validation
276 * that the correct exception is being thrown. For example, to check 276 * that the correct exception is being thrown. For example, to check
277 * the type of the exception you could write this: 277 * the type of the exception you could write this:
278 * 278 *
(...skipping 29 matching lines...) Expand all
308 bool _identical(a, b) => identical(a, b); 308 bool _identical(a, b) => identical(a, b);
309 309
310 typedef bool _CheckExceptionFn(exception); 310 typedef bool _CheckExceptionFn(exception);
311 311
312 @deprecated 312 @deprecated
313 class ExpectException implements Exception { 313 class ExpectException implements Exception {
314 ExpectException(this.message); 314 ExpectException(this.message);
315 String toString() => message; 315 String toString() => message;
316 String message; 316 String message;
317 } 317 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698