| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 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 | 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 library docs_test; | 5 library docs_test; |
| 6 | 6 |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 | 8 |
| 9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 import 'package:path/path.dart' as path; |
| 10 | 11 |
| 11 import '../bin/docs.dart'; | 12 import '../bin/docs.dart'; |
| 12 import '../lib/docs.dart'; | 13 import '../lib/docs.dart'; |
| 13 | 14 |
| 14 final testJsonPath = scriptDir.append('test.json').canonicalize(); | 15 final testJsonPath = path.normalize(path.join(scriptDir, 'test.json')); |
| 15 | 16 |
| 16 main() { | 17 main() { |
| 17 group('docs', () { | 18 group('docs', () { |
| 18 var oldJson = new File.fromPath(json_path); | 19 var oldJson = new File(json_path); |
| 19 var testJson = new File.fromPath(testJsonPath); | 20 var testJson = new File(testJsonPath); |
| 20 | 21 |
| 21 tearDown(() { | 22 tearDown(() { |
| 22 // Clean up. | 23 // Clean up. |
| 23 if (testJson.existsSync()) { | 24 if (testJson.existsSync()) { |
| 24 testJson.deleteSync(); | 25 testJson.deleteSync(); |
| 25 } | 26 } |
| 26 assert(!testJson.existsSync()); | 27 assert(!testJson.existsSync()); |
| 27 }); | 28 }); |
| 28 | 29 |
| 29 test('Ensure that docs.json is up to date', () { | 30 test('Ensure that docs.json is up to date', () { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 46 | 47 |
| 47 // Ensure that there's nothing different between the new JSON and old. | 48 // Ensure that there's nothing different between the new JSON and old. |
| 48 expect(testJson.readAsStringSync(), equals(oldJson.readAsStringSync())); | 49 expect(testJson.readAsStringSync(), equals(oldJson.readAsStringSync())); |
| 49 | 50 |
| 50 // Ensure that the old JSON file didn't actually change. | 51 // Ensure that the old JSON file didn't actually change. |
| 51 expect(oldJsonModified, equals(oldJson.lastModifiedSync())); | 52 expect(oldJsonModified, equals(oldJson.lastModifiedSync())); |
| 52 }), completes); | 53 }), completes); |
| 53 }); | 54 }); |
| 54 }); | 55 }); |
| 55 } | 56 } |
| OLD | NEW |