| OLD | NEW |
| (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 } |
| OLD | NEW |