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

Unified Diff: tools/dom/docs/lib/docs.dart

Issue 13000005: Added tests for docs.dart (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | « tools/dom/docs/docs.status ('k') | tools/dom/docs/test/docs_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/docs/lib/docs.dart
diff --git a/tools/dom/docs/lib/docs.dart b/tools/dom/docs/lib/docs.dart
index e4606ff259e787af36fb5302b6fb2fc9042cf990..1b38913ed9eaedccf757f8d74cb93f1b68823016 100644
--- a/tools/dom/docs/lib/docs.dart
+++ b/tools/dom/docs/lib/docs.dart
@@ -1,3 +1,7 @@
+// Copyright (c) 2013, 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.
+
/**
* A library for extracting the documentation from the various HTML libraries
* ([dart:html], [dart:svg], [dart:web_audio], [dart:indexed_db]) and saving
@@ -55,18 +59,20 @@ Future<bool> convert(Path libPath, Path jsonPath) {
return analyze(paths, libPath, options: ['--preserve-comments'])
.then((MirrorSystem mirrors) {
var convertedJson = _generateJsonFromLibraries(mirrors);
- return new Future.immediate(_exportJsonToFile(convertedJson, jsonPath));
+ return _exportJsonToFile(convertedJson, jsonPath);
});
}
-bool _exportJsonToFile(Map convertedJson, Path jsonPath) {
- final jsonFile = new File.fromPath(jsonPath);
- var writeJson = prettySerialize(convertedJson);
-
- var outputStream = jsonFile.openWrite();
- outputStream.writeln(writeJson);
+Future<bool> _exportJsonToFile(Map convertedJson, Path jsonPath) {
+ return new Future.of(() {
+ final jsonFile = new File.fromPath(jsonPath);
+ var writeJson = prettySerialize(convertedJson);
- return false;
+ var outputStream = jsonFile.openWrite();
+ outputStream.writeln(writeJson);
+ outputStream.close();
+ return outputStream.done.then((_) => false);
+ });
}
Map _generateJsonFromLibraries(MirrorSystem mirrors) {
« no previous file with comments | « tools/dom/docs/docs.status ('k') | tools/dom/docs/test/docs_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698