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

Side by Side Diff: sdk/lib/_internal/dartdoc/test/dartdoc_test.dart

Issue 13861024: Have dartdoc document exports. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes on top of original commit 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /// Unit tests for doc. 5 /// Unit tests for doc.
6 library dartdocTests; 6 library dartdocTests;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:io'; 9 import 'dart:io';
10 10
11 import 'package:pathos/path.dart' as path; 11 import 'package:pathos/path.dart' as path;
12 import 'package:unittest/unittest.dart'; 12 import 'package:unittest/unittest.dart';
13 13
14 // TODO(rnystrom): Use "package:" URL (#4968). 14 // TODO(rnystrom): Use "package:" URL (#4968).
15 import '../lib/dartdoc.dart' as dd; 15 import '../lib/dartdoc.dart' as dd;
16 import '../lib/markdown.dart'; 16 import '../lib/markdown.dart';
17 import 'markdown_test.dart'; 17 import 'markdown_test.dart';
18 18
19 main() { 19 main() {
20 group('countOccurrences', () {
21 test('empty text returns 0', () {
22 expect(dd.countOccurrences('', 'needle'), equals(0));
23 });
24
25 test('one occurrence', () {
26 expect(dd.countOccurrences('bananarama', 'nara'), equals(1));
27 });
28
29 test('multiple occurrences', () {
30 expect(dd.countOccurrences('bananarama', 'a'), equals(5));
31 });
32
33 test('overlapping matches do not count', () {
34 expect(dd.countOccurrences('bananarama', 'ana'), equals(1));
35 });
36 });
37
38 group('repeat', () {
39 test('zero times returns an empty string', () {
40 expect(dd.repeat('ba', 0), isEmpty);
41 });
42
43 test('one time returns the string', () {
44 expect(dd.repeat('ba', 1), equals('ba'));
45 });
46
47 test('multiple times', () {
48 expect(dd.repeat('ba', 3), equals('bababa'));
49 });
50
51 test('multiple times with a separator', () {
52 expect(dd.repeat('ba', 3, separator: ' '), equals('ba ba ba'));
53 });
54 });
55
56 group('isAbsolute', () { 20 group('isAbsolute', () {
57 final doc = new dd.Dartdoc(); 21 final doc = new dd.Dartdoc();
58 22
59 test('returns false if there is no scheme', () { 23 test('returns false if there is no scheme', () {
60 expect(doc.isAbsolute('index.html'), isFalse); 24 expect(doc.isAbsolute('index.html'), isFalse);
61 expect(doc.isAbsolute('foo/index.html'), isFalse); 25 expect(doc.isAbsolute('foo/index.html'), isFalse);
62 expect(doc.isAbsolute('foo/bar/index.html'), isFalse); 26 expect(doc.isAbsolute('foo/bar/index.html'), isFalse);
63 }); 27 });
64 28
65 test('returns true if there is a scheme', () { 29 test('returns true if there is a scheme', () {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 }); 173 });
210 }); 174 });
211 175
212 test('entrypoint somewhere with packages locally', () { 176 test('entrypoint somewhere with packages locally', () {
213 _testRunDartDoc(['test_files/package_test_file.dart'], (result) { 177 _testRunDartDoc(['test_files/package_test_file.dart'], (result) {
214 expect(result.exitCode, 0); 178 expect(result.exitCode, 0);
215 _expectDocumented(result.stdout, libCount: 1, typeCount: 1, memberCount: 0); 179 _expectDocumented(result.stdout, libCount: 1, typeCount: 1, memberCount: 0);
216 }); 180 });
217 }); 181 });
218 182
219 test('file does not exist', () { 183 solo_test('file does not exist', () {
Andrei Mouravski 2013/04/09 20:06:14 Forgot to remove.
nweiz 2013/04/09 20:09:53 Done.
220 _testRunDartDoc(['test_files/this_file_does_not_exist.dart'], (result) { 184 _testRunDartDoc(['test_files/this_file_does_not_exist.dart'], (result) {
221 expect(result.exitCode, 1); 185 expect(result.exitCode, 1);
222 }); 186 });
223 }); 187 });
224 }); 188 });
225 } 189 }
226 190
227 void _testRunDartDoc(List<String> libraryPaths, void eval(ProcessResult)) { 191 void _testRunDartDoc(List<String> libraryPaths, void eval(ProcessResult)) {
228 expect(_runDartdoc(libraryPaths).then(eval), completes); 192 expect(_runDartdoc(libraryPaths).then(eval), completes);
229 } 193 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 } 273 }
310 } 274 }
311 275
312 276
313 validateDartdocMarkdown(String description, String markdown, 277 validateDartdocMarkdown(String description, String markdown,
314 String html) { 278 String html) {
315 var dartdoc = new dd.Dartdoc(); 279 var dartdoc = new dd.Dartdoc();
316 validate(description, markdown, html, linkResolver: dartdoc.dartdocResolver, 280 validate(description, markdown, html, linkResolver: dartdoc.dartdocResolver,
317 inlineSyntaxes: dartdoc.dartdocSyntaxes); 281 inlineSyntaxes: dartdoc.dartdocSyntaxes);
318 } 282 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/dartdoc/pubspec.yaml ('k') | sdk/lib/_internal/dartdoc/test/export_map_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698