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

Side by Side Diff: pkg/analysis_server/test/services/correction/strings_test.dart

Issue 626883003: Fix for the prefix/suffix diff computing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 test.services.correction.strings; 5 library test.services.correction.strings;
6 6
7 import 'package:analysis_server/src/services/correction/strings.dart'; 7 import 'package:analysis_server/src/services/correction/strings.dart';
8 import 'package:unittest/unittest.dart' hide isEmpty; 8 import 'package:unittest/unittest.dart' hide isEmpty;
9 9
10 import '../../reflective_tests.dart'; 10 import '../../reflective_tests.dart';
(...skipping 17 matching lines...) Expand all
28 } 28 }
29 29
30 void test_compareStrings() { 30 void test_compareStrings() {
31 expect(compareStrings(null, null), 0); 31 expect(compareStrings(null, null), 0);
32 expect(compareStrings(null, 'b'), 1); 32 expect(compareStrings(null, 'b'), 1);
33 expect(compareStrings('a', null), -1); 33 expect(compareStrings('a', null), -1);
34 expect(compareStrings('a', 'b'), -1); 34 expect(compareStrings('a', 'b'), -1);
35 expect(compareStrings('b', 'a'), 1); 35 expect(compareStrings('b', 'a'), 1);
36 } 36 }
37 37
38 void test_findCommonOverlap() {
39 expect(findCommonOverlap('', 'abcd'), 0);
40 expect(findCommonOverlap('abc', 'abcd'), 3);
41 expect(findCommonOverlap('123456', 'abcd'), 0);
42 expect(findCommonOverlap('123456xxx', 'xxxabcd'), 3);
43 expect(findCommonOverlap('123456', '56'), 2);
44 expect(findCommonOverlap('56', '56789'), 2);
45 }
46
47 void test_findCommonPrefix() {
48 expect(findCommonPrefix('abc', 'xyz'), 0);
49 expect(findCommonPrefix('1234abcdef', '1234xyz'), 4);
50 expect(findCommonPrefix('123', '123xyz'), 3);
51 }
52
53 void test_findCommonSuffix() {
54 expect(findCommonSuffix('abc', 'xyz'), 0);
55 expect(findCommonSuffix('abcdef1234', 'xyz1234'), 4);
56 expect(findCommonSuffix('123', 'xyz123'), 3);
57 }
58
38 void test_isBlank() { 59 void test_isBlank() {
39 expect(isBlank(null), isTrue); 60 expect(isBlank(null), isTrue);
40 expect(isBlank(''), isTrue); 61 expect(isBlank(''), isTrue);
41 expect(isBlank(' '), isTrue); 62 expect(isBlank(' '), isTrue);
42 expect(isBlank('\t'), isTrue); 63 expect(isBlank('\t'), isTrue);
43 expect(isBlank(' '), isTrue); 64 expect(isBlank(' '), isTrue);
44 expect(isBlank('X'), isFalse); 65 expect(isBlank('X'), isFalse);
45 } 66 }
46 67
47 void test_isDigit() { 68 void test_isDigit() {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 expect(repeat('abc', 3), 'abcabcabc'); 173 expect(repeat('abc', 3), 'abcabcabc');
153 } 174 }
154 175
155 void test_substringAfterLast() { 176 void test_substringAfterLast() {
156 expect(substringAfterLast('', '/'), ''); 177 expect(substringAfterLast('', '/'), '');
157 expect(substringAfterLast('abc', ''), ''); 178 expect(substringAfterLast('abc', ''), '');
158 expect(substringAfterLast('abc', 'd'), 'abc'); 179 expect(substringAfterLast('abc', 'd'), 'abc');
159 expect(substringAfterLast('abcbde', 'b'), 'de'); 180 expect(substringAfterLast('abcbde', 'b'), 'de');
160 } 181 }
161 } 182 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698