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

Side by Side Diff: corelib/src/expect.dart

Issue 9365023: add string-equals to unittest, fix implementation in expect.dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 8 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 | Annotate | Revision Log
« no previous file with comments | « client/testing/unittest/shared.dart ('k') | 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) 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 class Expect { 5 class Expect {
6 6
7 /** 7 /**
8 * Checks whether the expected and actual values are equal (using [:==:]). 8 * Checks whether the expected and actual values are equal (using [:==:]).
9 */ 9 */
10 static void equals(var expected, var actual, [String reason = null]) { 10 static void equals(var expected, var actual, [String reason = null]) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 _fail('$defaultMessage\nDiff:\n[ ]...\n[ $snippet ]...'); 170 _fail('$defaultMessage\nDiff:\n[ ]...\n[ $snippet ]...');
171 return; 171 return;
172 } 172 }
173 if (expected[eLen - right - 1] != actual[aLen - right - 1]) { 173 if (expected[eLen - right - 1] != actual[aLen - right - 1]) {
174 break; 174 break;
175 } 175 }
176 right++; 176 right++;
177 } 177 }
178 String eSnippet = expected.substring(left, eLen - right); 178 String eSnippet = expected.substring(left, eLen - right);
179 String aSnippet = actual.substring(left, aLen - right); 179 String aSnippet = actual.substring(left, aLen - right);
180 String diff = '\nDiff:\n...[ $eSnippet} ]...\n...[ $aSnippet ]...'; 180 String diff = '\nDiff:\n...[ $eSnippet ]...\n...[ $aSnippet ]...';
181 _fail('$defaultMessage$diff'); 181 _fail('$defaultMessage$diff');
182 } 182 }
183 183
184 /** 184 /**
185 * Checks that every element of [expected] is also in [actual], and that 185 * Checks that every element of [expected] is also in [actual], and that
186 * every element of [actual] is also in [expected]. 186 * every element of [actual] is also in [expected].
187 */ 187 */
188 static void setEquals(Iterable expected, 188 static void setEquals(Iterable expected,
189 Iterable actual, 189 Iterable actual,
190 [String reason = null]) { 190 [String reason = null]) {
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 } 251 }
252 } 252 }
253 253
254 typedef bool _CheckExceptionFn(exception); 254 typedef bool _CheckExceptionFn(exception);
255 255
256 class ExpectException implements Exception { 256 class ExpectException implements Exception {
257 ExpectException(this.message); 257 ExpectException(this.message);
258 String toString() => message; 258 String toString() => message;
259 String message; 259 String message;
260 } 260 }
OLDNEW
« no previous file with comments | « client/testing/unittest/shared.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698