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

Side by Side 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 dartdoc working with latest frog. Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/dartdoc/dartdoc.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// Unit tests for dartdoc.
6 #library('dartdoc_tests');
7
8 #import('../dartdoc.dart');
9
10 // TODO(rnystrom): Better path to unittest.
11 #import('../../../client/testing/unittest/unittest_node.dart');
12
13 main() {
14 group('countOccurrences', () {
15 test('empty text returns 0', () {
16 expect(countOccurrences('', 'needle')).equals(0);
17 });
18
19 test('one occurrence', () {
20 expect(countOccurrences('bananarama', 'nara')).equals(1);
21 });
22
23 test('multiple occurrences', () {
24 expect(countOccurrences('bananarama', 'a')).equals(5);
25 });
26
27 test('overlapping matches do not count', () {
28 expect(countOccurrences('bananarama', 'ana')).equals(1);
29 });
30 });
31
32 group('repeat', () {
33 test('zero times returns an empty string', () {
34 expect(repeat('ba', 0)).equals('');
35 });
36
37 test('one time returns the string', () {
38 expect(repeat('ba', 1)).equals('ba');
39 });
40
41 test('multiple times', () {
42 expect(repeat('ba', 3)).equals('bababa');
43 });
44
45 test('multiple times with a separator', () {
46 expect(repeat('ba', 3, separator: ' ')).equals('ba ba ba');
47 });
48 });
49
50 group('relativePath', () {
51 test('from root to root', () {
52 startFile('root.html');
53 expect(relativePath('other.html')).equals('other.html');
54 });
55
56 test('from root to directory', () {
57 startFile('root.html');
58 expect(relativePath('dir/file.html')).equals('dir/file.html');
59 });
60
61 test('from root to nested', () {
62 startFile('root.html');
63 expect(relativePath('dir/sub/file.html')).equals('dir/sub/file.html');
64 });
65
66 test('from directory to root', () {
67 startFile('dir/file.html');
68 expect(relativePath('root.html')).equals('../root.html');
69 });
70
71 test('from nested to root', () {
72 startFile('dir/sub/file.html');
73 expect(relativePath('root.html')).equals('../../root.html');
74 });
75
76 test('from dir to dir with different path', () {
77 startFile('dir/file.html');
78 expect(relativePath('other/file.html')).equals('../other/file.html');
79 });
80
81 test('from nested to nested with different path', () {
82 startFile('dir/sub/file.html');
83 expect(relativePath('other/sub/file.html')).equals(
84 '../../other/sub/file.html');
85 });
86
87 test('from nested to directory with different path', () {
88 startFile('dir/sub/file.html');
89 expect(relativePath('other/file.html')).equals(
90 '../../other/file.html');
91 });
92 });
93 }
OLDNEW
« no previous file with comments | « utils/dartdoc/dartdoc.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698