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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/services/correction/strings_test.dart
diff --git a/pkg/analysis_server/test/services/correction/strings_test.dart b/pkg/analysis_server/test/services/correction/strings_test.dart
index ea26934a62483be78b4f6c32991e6a39851b2974..cba4315faffbc9016c472f7624ad753fd31a1e55 100644
--- a/pkg/analysis_server/test/services/correction/strings_test.dart
+++ b/pkg/analysis_server/test/services/correction/strings_test.dart
@@ -35,6 +35,27 @@ class StringsTest {
expect(compareStrings('b', 'a'), 1);
}
+ void test_findCommonOverlap() {
+ expect(findCommonOverlap('', 'abcd'), 0);
+ expect(findCommonOverlap('abc', 'abcd'), 3);
+ expect(findCommonOverlap('123456', 'abcd'), 0);
+ expect(findCommonOverlap('123456xxx', 'xxxabcd'), 3);
+ expect(findCommonOverlap('123456', '56'), 2);
+ expect(findCommonOverlap('56', '56789'), 2);
+ }
+
+ void test_findCommonPrefix() {
+ expect(findCommonPrefix('abc', 'xyz'), 0);
+ expect(findCommonPrefix('1234abcdef', '1234xyz'), 4);
+ expect(findCommonPrefix('123', '123xyz'), 3);
+ }
+
+ void test_findCommonSuffix() {
+ expect(findCommonSuffix('abc', 'xyz'), 0);
+ expect(findCommonSuffix('abcdef1234', 'xyz1234'), 4);
+ expect(findCommonSuffix('123', 'xyz123'), 3);
+ }
+
void test_isBlank() {
expect(isBlank(null), isTrue);
expect(isBlank(''), isTrue);

Powered by Google App Engine
This is Rietveld 408576698