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

Side by Side 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, 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
« no previous file with comments | « tools/dom/docs/lib/docs.dart ('k') | tools/test.dart » ('j') | 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) 2013, 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 library docs_test;
6
7 import 'dart:io';
8
9 import '../../../../pkg/unittest/lib/unittest.dart';
10
11 import '../bin/docs.dart';
12 import '../lib/docs.dart';
13
14 final testJsonPath = scriptDir.append('test.json').canonicalize();
15
16 main() {
17 test('Ensure that docs.json is up to date', () {
18 var oldJson = new File.fromPath(json_path);
19 var testJson = new File.fromPath(testJsonPath);
20
21 // We should find a json file where we expect it.
22 expect(oldJson.existsSync(), isTrue);
23
24 // Save the last modified time to check it at the end.
25 var oldJsonModified = oldJson.lastModifiedSync();
26
27 // There should be no test file yet.
28 if (testJson.existsSync()) testJson.deleteSync();
29 expect(testJson.existsSync(), isFalse);
30
31 expect(convert(lib_path, testJsonPath)
32 .then((bool anyErrors) {
33 expect(anyErrors, isFalse);
34
35 // We should have a file now.
36 expect(testJson.existsSync(), isTrue);
37
38 // Ensure that there's nothing different between the new JSON and old.
39 expect(testJson.readAsStringSync(), equals(oldJson.readAsStringSync()));
40
41 // Ensure that the old JSON file didn't actually change.
42 expect(oldJsonModified, equals(oldJson.lastModifiedSync()));
43
44 // Clean up.
45 if (testJson.existsSync()) {
46 testJson.deleteSync();
47 }
48 expect(testJson.existsSync(), isFalse);
49 }), completes);
50 });
51 }
OLDNEW
« 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