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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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
« no previous file with comments | « sdk/lib/core/errors.dart ('k') | sdk/lib/core/future.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) 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 * Expect is used for tests that do not want to make use of the 8 * Expect is used for tests that do not want to make use of the
9 * Dart unit test library - for example, the core language tests. 9 * Dart unit test library - for example, the core language tests.
10 * Third parties are discouraged from using this, and should use 10 * Third parties are discouraged from using this, and should use
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 if (expected[i] != actual[i]) { 113 if (expected[i] != actual[i]) {
114 _fail('Expect.listEquals(at index $i, ' 114 _fail('Expect.listEquals(at index $i, '
115 'expected: <${expected[i]}>, actual: <${actual[i]}>$msg) fails'); 115 'expected: <${expected[i]}>, actual: <${actual[i]}>$msg) fails');
116 } 116 }
117 } 117 }
118 // We check on length at the end in order to provide better error 118 // We check on length at the end in order to provide better error
119 // messages when an unexpected item is inserted in a list. 119 // messages when an unexpected item is inserted in a list.
120 if (expected.length != actual.length) { 120 if (expected.length != actual.length) {
121 _fail('Expect.listEquals(list length, ' 121 _fail('Expect.listEquals(list length, '
122 'expected: <${expected.length}>, actual: <${actual.length}>$msg) ' 122 'expected: <${expected.length}>, actual: <${actual.length}>$msg) '
123 'fails'); 123 'fails: Next element <'
124 '${expected.length > n ? expected[n] : actual[n]}>');
124 } 125 }
125 } 126 }
126 127
127 /** 128 /**
128 * Checks that all [expected] and [actual] have the same set of keys (using 129 * Checks that all [expected] and [actual] have the same set of keys (using
129 * the semantics of [Map.containsKey] to determine what "same" means. For 130 * the semantics of [Map.containsKey] to determine what "same" means. For
130 * each key, checks that the values in both maps are equal using `==`. 131 * each key, checks that the values in both maps are equal using `==`.
131 */ 132 */
132 static void mapEquals(Map expected, Map actual, [String reason = null]) { 133 static void mapEquals(Map expected, Map actual, [String reason = null]) {
133 String msg = _getMessage(reason); 134 String msg = _getMessage(reason);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 290
290 bool _identical(a, b) => identical(a, b); 291 bool _identical(a, b) => identical(a, b);
291 292
292 typedef bool _CheckExceptionFn(exception); 293 typedef bool _CheckExceptionFn(exception);
293 294
294 class ExpectException implements Exception { 295 class ExpectException implements Exception {
295 ExpectException(this.message); 296 ExpectException(this.message);
296 String toString() => message; 297 String toString() => message;
297 String message; 298 String message;
298 } 299 }
OLDNEW
« no previous file with comments | « sdk/lib/core/errors.dart ('k') | sdk/lib/core/future.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698