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

Unified Diff: tools/dom/docs/test/docs_test.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/lib/docs.dart ('k') | tools/test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/docs/test/docs_test.dart
diff --git a/tools/dom/docs/test/docs_test.dart b/tools/dom/docs/test/docs_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..7105135797f20f2153e212a4950a3079284f5933
--- /dev/null
+++ b/tools/dom/docs/test/docs_test.dart
@@ -0,0 +1,51 @@
+// 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.
+
+library docs_test;
+
+import 'dart:io';
+
+import '../../../../pkg/unittest/lib/unittest.dart';
+
+import '../bin/docs.dart';
+import '../lib/docs.dart';
+
+final testJsonPath = scriptDir.append('test.json').canonicalize();
+
+main() {
+ test('Ensure that docs.json is up to date', () {
+ var oldJson = new File.fromPath(json_path);
+ var testJson = new File.fromPath(testJsonPath);
+
+ // We should find a json file where we expect it.
+ expect(oldJson.existsSync(), isTrue);
+
+ // Save the last modified time to check it at the end.
+ var oldJsonModified = oldJson.lastModifiedSync();
+
+ // There should be no test file yet.
+ if (testJson.existsSync()) testJson.deleteSync();
+ expect(testJson.existsSync(), isFalse);
+
+ expect(convert(lib_path, testJsonPath)
+ .then((bool anyErrors) {
+ expect(anyErrors, isFalse);
+
+ // We should have a file now.
+ expect(testJson.existsSync(), isTrue);
+
+ // Ensure that there's nothing different between the new JSON and old.
+ expect(testJson.readAsStringSync(), equals(oldJson.readAsStringSync()));
+
+ // Ensure that the old JSON file didn't actually change.
+ expect(oldJsonModified, equals(oldJson.lastModifiedSync()));
+
+ // Clean up.
+ if (testJson.existsSync()) {
+ testJson.deleteSync();
+ }
+ expect(testJson.existsSync(), isFalse);
+ }), completes);
+ });
+}
« no previous file with comments | « tools/dom/docs/lib/docs.dart ('k') | tools/test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698