Index: sdk/lib/_internal/dartdoc/test/dartdoc_test.dart |
diff --git a/sdk/lib/_internal/dartdoc/test/dartdoc_test.dart b/sdk/lib/_internal/dartdoc/test/dartdoc_test.dart |
index 60eb3ac1b00555691cb114ad74057f037cda687a..c32c47f446a2f3247daff867100d36dbb3c3d050 100644 |
--- a/sdk/lib/_internal/dartdoc/test/dartdoc_test.dart |
+++ b/sdk/lib/_internal/dartdoc/test/dartdoc_test.dart |
@@ -17,6 +17,42 @@ import '../lib/markdown.dart'; |
import 'markdown_test.dart'; |
main() { |
+ group('countOccurrences', () { |
+ test('empty text returns 0', () { |
+ expect(dd.countOccurrences('', 'needle'), equals(0)); |
+ }); |
+ |
+ test('one occurrence', () { |
+ expect(dd.countOccurrences('bananarama', 'nara'), equals(1)); |
+ }); |
+ |
+ test('multiple occurrences', () { |
+ expect(dd.countOccurrences('bananarama', 'a'), equals(5)); |
+ }); |
+ |
+ test('overlapping matches do not count', () { |
+ expect(dd.countOccurrences('bananarama', 'ana'), equals(1)); |
+ }); |
+ }); |
+ |
+ group('repeat', () { |
+ test('zero times returns an empty string', () { |
+ expect(dd.repeat('ba', 0), isEmpty); |
+ }); |
+ |
+ test('one time returns the string', () { |
+ expect(dd.repeat('ba', 1), equals('ba')); |
+ }); |
+ |
+ test('multiple times', () { |
+ expect(dd.repeat('ba', 3), equals('bababa')); |
+ }); |
+ |
+ test('multiple times with a separator', () { |
+ expect(dd.repeat('ba', 3, separator: ' '), equals('ba ba ba')); |
+ }); |
+ }); |
+ |
group('isAbsolute', () { |
final doc = new dd.Dartdoc(); |