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

Unified Diff: utils/dartdoc/test/dartdoc_tests.dart

Issue 8758010: Create separate HTML pages for each type. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Get rid of explicit link stuff and just use fixed URLs. Created 9 years, 1 month 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
« utils/dartdoc/dartdoc.dart ('K') | « utils/dartdoc/dartdoc.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/dartdoc/test/dartdoc_tests.dart
diff --git a/utils/dartdoc/test/dartdoc_tests.dart b/utils/dartdoc/test/dartdoc_tests.dart
new file mode 100644
index 0000000000000000000000000000000000000000..c6f7a9e33a8fce44d15607ed6e979a5f2ed6fbf3
--- /dev/null
+++ b/utils/dartdoc/test/dartdoc_tests.dart
@@ -0,0 +1,93 @@
+// Copyright (c) 2011, 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.
+
+/// Unit tests for dartdoc.
+#library('dartdoc_tests');
+
+#import('../dartdoc.dart');
+
+// TODO(rnystrom): Better path to unittest.
pquitslund 2011/12/01 23:29:54 Hear, hear!
+#import('../../../client/testing/unittest/unittest_node.dart');
+
+main() {
+ group('countOccurrences', () {
+ test('empty haystack 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 ones needles do not count', () {
+ expect(countOccurrences('bananarama', 'ana')).equals(1);
+ });
+ });
+
+ group('repeat', () {
+ test('zero times returns an empty string', () {
+ expect(repeat('ba', 0)).equals('');
+ });
+
+ 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');
+ });
+ });
+
+ group('relativePath', () {
+ test('from root to root', () {
+ startFile('root.html');
+ expect(relativePath('other.html')).equals('other.html');
+ });
+
+ test('from root to directory', () {
+ startFile('root.html');
+ expect(relativePath('dir/file.html')).equals('dir/file.html');
+ });
+
+ test('from root to nested', () {
+ startFile('root.html');
+ expect(relativePath('dir/sub/file.html')).equals('dir/sub/file.html');
+ });
+
+ test('from directory to root', () {
+ startFile('dir/file.html');
+ expect(relativePath('root.html')).equals('../root.html');
+ });
+
+ test('from nested to root', () {
+ startFile('dir/sub/file.html');
+ expect(relativePath('root.html')).equals('../../root.html');
+ });
+
+ test('from dir to dir with different path', () {
+ startFile('dir/file.html');
+ expect(relativePath('other/file.html')).equals('../other/file.html');
+ });
+
+ test('from nested to nested with different path', () {
+ startFile('dir/sub/file.html');
+ expect(relativePath('other/sub/file.html')).equals(
+ '../../other/sub/file.html');
+ });
+
+ test('from nested to directory with different path', () {
+ startFile('dir/sub/file.html');
+ expect(relativePath('other/file.html')).equals(
+ '../../other/file.html');
+ });
+ });
+}
« utils/dartdoc/dartdoc.dart ('K') | « utils/dartdoc/dartdoc.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698