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

Side by Side Diff: lib/src/core_matchers.dart

Issue 928333004: pkg/matcher: Small tweaks to improve analysis (Closed) Base URL: https://github.com/dart-lang/matcher.git@master
Patch Set: Created 5 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 | lib/src/iterable_matchers.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 library matcher.core_matchers; 5 library matcher.core_matchers;
6 6
7 import 'description.dart'; 7 import 'description.dart';
8 import 'interfaces.dart'; 8 import 'interfaces.dart';
9 import 'util.dart'; 9 import 'util.dart';
10 10
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 if (item is! String) { 295 if (item is! String) {
296 return mismatchDescription.addDescriptionOf(item).add('is not a string'); 296 return mismatchDescription.addDescriptionOf(item).add('is not a string');
297 } else { 297 } else {
298 var buff = new StringBuffer(); 298 var buff = new StringBuffer();
299 buff.write('is different.'); 299 buff.write('is different.');
300 var escapedItem = escape(item); 300 var escapedItem = escape(item);
301 var escapedValue = escape(_value); 301 var escapedValue = escape(_value);
302 int minLength = escapedItem.length < escapedValue.length 302 int minLength = escapedItem.length < escapedValue.length
303 ? escapedItem.length 303 ? escapedItem.length
304 : escapedValue.length; 304 : escapedValue.length;
305 int start; 305 int start = 0;
nweiz 2015/02/19 20:46:41 While you're in here, change this to "var".
kevmoo 2015/02/23 23:21:56 Done.
306 for (start = 0; start < minLength; start++) { 306 for (; start < minLength; start++) {
307 if (escapedValue.codeUnitAt(start) != escapedItem.codeUnitAt(start)) { 307 if (escapedValue.codeUnitAt(start) != escapedItem.codeUnitAt(start)) {
308 break; 308 break;
309 } 309 }
310 } 310 }
311 if (start == minLength) { 311 if (start == minLength) {
312 if (escapedValue.length < escapedItem.length) { 312 if (escapedValue.length < escapedItem.length) {
313 buff.write(' Both strings start the same, but the given value also' 313 buff.write(' Both strings start the same, but the given value also'
314 ' has the following trailing characters: '); 314 ' has the following trailing characters: ');
315 _writeTrailing(buff, escapedItem, escapedValue.length); 315 _writeTrailing(buff, escapedItem, escapedValue.length);
316 } else { 316 } else {
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 .addDescriptionOf(matchState['feature']); 644 .addDescriptionOf(matchState['feature']);
645 var innerDescription = new StringDescription(); 645 var innerDescription = new StringDescription();
646 _matcher.describeMismatch( 646 _matcher.describeMismatch(
647 matchState['feature'], innerDescription, matchState['state'], verbose); 647 matchState['feature'], innerDescription, matchState['state'], verbose);
648 if (innerDescription.length > 0) { 648 if (innerDescription.length > 0) {
649 mismatchDescription.add(' which ').add(innerDescription.toString()); 649 mismatchDescription.add(' which ').add(innerDescription.toString());
650 } 650 }
651 return mismatchDescription; 651 return mismatchDescription;
652 } 652 }
653 } 653 }
OLDNEW
« no previous file with comments | « no previous file | lib/src/iterable_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698