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

Unified Diff: sdk/lib/_internal/dartdoc/test/utils_test.dart

Issue 14194003: Revert "Revert "Attempt to re-commit Dartdoc exports."" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Maybe... Created 7 years, 8 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
« no previous file with comments | « sdk/lib/_internal/dartdoc/test/export_map_test.dart ('k') | utils/apidoc/apidoc.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/dartdoc/test/utils_test.dart
diff --git a/sdk/lib/_internal/dartdoc/test/utils_test.dart b/sdk/lib/_internal/dartdoc/test/utils_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..fae4eec24609ebd925998dc8e53c1307d18faa10
--- /dev/null
+++ b/sdk/lib/_internal/dartdoc/test/utils_test.dart
@@ -0,0 +1,45 @@
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:unittest/unittest.dart';
+
+import '../lib/src/dartdoc/utils.dart';
+
+void main() {
+ group('countOccurrences', () {
+ test('empty text returns 0', () {
+ expect(countOccurrences('', 'needle'), equals(0));
+ });
+
+ test('one occurrence', () {
+ expect(countOccurrences('bananarama', 'nara'), equals(1));
+ });
+
+ test('multiple occurrences', () {
+ expect(countOccurrences('bananarama', 'a'), equals(5));
+ });
+
+ test('overlapping matches do not count', () {
+ expect(countOccurrences('bananarama', 'ana'), equals(1));
+ });
+ });
+
+ group('repeat', () {
+ test('zero times returns an empty string', () {
+ expect(repeat('ba', 0), isEmpty);
+ });
+
+ test('one time returns the string', () {
+ expect(repeat('ba', 1), equals('ba'));
+ });
+
+ test('multiple times', () {
+ expect(repeat('ba', 3), equals('bababa'));
+ });
+
+ test('multiple times with a separator', () {
+ expect(repeat('ba', 3, separator: ' '), equals('ba ba ba'));
+ });
+ });
+}
« no previous file with comments | « sdk/lib/_internal/dartdoc/test/export_map_test.dart ('k') | utils/apidoc/apidoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698