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 3fb37fbffbd0deb956868bbd36c3765e2b32cbbf..a5b4779b48c9f06717c76c020116675e00176770 100644 |
--- a/pkg/analysis_server/test/services/correction/strings_test.dart |
+++ b/pkg/analysis_server/test/services/correction/strings_test.dart |
@@ -33,6 +33,27 @@ class StringsTest { |
expect(compareStrings('b', 'a'), 1); |
} |
+ void test_computeSimpleDiff() { |
+ assertDiff(String oldStr, String newStr) { |
+ SimpleDiff diff = computeSimpleDiff(oldStr, newStr); |
+ expect(diff.offset, isNonNegative); |
+ expect(diff.length, isNonNegative); |
+ String applied = oldStr.substring(0, diff.offset) + |
+ diff.replacement + |
+ oldStr.substring(diff.offset + diff.length); |
+ expect(applied, newStr); |
+ } |
+ assertDiff('', ''); |
+ assertDiff('', 'a'); |
+ assertDiff('abc', ''); |
+ assertDiff('abcd', 'acd'); |
+ assertDiff('a', 'b'); |
+ assertDiff('12345xyz', '12345abcxyz'); |
+ assertDiff('12345xyz', '12345xyzabc'); |
+ assertDiff('abbc', 'abbbc'); |
+ assertDiff('abbbbc', 'abbbbbbc'); |
+ } |
+ |
void test_countMatches() { |
expect(countMatches(null, null), 0); |
expect(countMatches('abc', null), 0); |
@@ -42,15 +63,6 @@ class StringsTest { |
expect(countMatches('aaabaa', 'aa'), 2); |
} |
- 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); |