OLD | NEW |
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 import '../../../../../pkg/pathos/lib/path.dart' as path; | 10 import '../../../../../pkg/pathos/lib/path.dart' as path; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 final runArgs = [dartdoc]; | 254 final runArgs = [dartdoc]; |
255 | 255 |
256 // Turn relative libraryPaths to absolute ones. | 256 // Turn relative libraryPaths to absolute ones. |
257 runArgs.addAll(libraryPaths | 257 runArgs.addAll(libraryPaths |
258 .map((e) => path.join(dd.scriptDir.toNativePath(), e))); | 258 .map((e) => path.join(dd.scriptDir.toNativePath(), e))); |
259 | 259 |
260 return Process.run(dartBin, runArgs); | 260 return Process.run(dartBin, runArgs); |
261 } | 261 } |
262 | 262 |
263 final _dartdocCompletionRegExp = | 263 final _dartdocCompletionRegExp = |
264 new RegExp(r'Documented (\d+) libraries, (\d+) types, and (\d+) members\.'); | 264 new RegExp(r'Documentation complete -- documented (\d+) libraries, (\d+) types
, and (\d+) members\.'); |
265 | 265 |
266 void _expectDocumented(String output, { int libCount, int typeCount, | 266 void _expectDocumented(String output, { int libCount, int typeCount, |
267 int memberCount}) { | 267 int memberCount}) { |
268 | 268 |
269 final completionMatches = _dartdocCompletionRegExp.allMatches(output) | 269 final completionMatches = _dartdocCompletionRegExp.allMatches(output) |
270 .toList(); | 270 .toList(); |
271 | 271 |
272 expect(completionMatches, hasLength(1), | 272 expect(completionMatches, hasLength(1), |
273 reason: 'dartdoc output should contain one summary'); | 273 reason: 'dartdoc output should contain one summary'); |
274 | 274 |
(...skipping 15 matching lines...) Expand all Loading... |
290 } | 290 } |
291 } | 291 } |
292 | 292 |
293 | 293 |
294 validateDartdocMarkdown(String description, String markdown, | 294 validateDartdocMarkdown(String description, String markdown, |
295 String html) { | 295 String html) { |
296 var dartdoc = new dd.Dartdoc(); | 296 var dartdoc = new dd.Dartdoc(); |
297 validate(description, markdown, html, linkResolver: dartdoc.dartdocResolver, | 297 validate(description, markdown, html, linkResolver: dartdoc.dartdocResolver, |
298 inlineSyntaxes: dartdoc.dartdocSyntaxes); | 298 inlineSyntaxes: dartdoc.dartdocSyntaxes); |
299 } | 299 } |
OLD | NEW |