OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 import 'dart:io' as io; | 5 import 'dart:io' as io; |
6 | 6 |
7 import '../lib/shared_messages.dart'; | 7 import '../lib/shared_messages.dart'; |
8 | 8 |
9 void testJsonIsUpdated() { | 9 void testJsonIsUpdated() { |
10 var packageRoot = io.Platform.packageRoot; | 10 var packageRoot = io.Platform.packageRoot; |
11 if (packageRoot == null || packageRoot == "") { | 11 if (packageRoot == null || packageRoot == "") { |
12 throw new UnsupportedError("This test requires a package root."); | 12 throw new UnsupportedError("This test requires a package root."); |
13 } | 13 } |
14 var jsonUri = Uri.parse(packageRoot).resolve( | 14 var jsonUri = Uri |
15 'dart_messages/generated/shared_messages.json'); | 15 .parse(packageRoot) |
| 16 .resolve('dart_messages/generated/shared_messages.json'); |
16 var jsonPath = jsonUri.toFilePath(); | 17 var jsonPath = jsonUri.toFilePath(); |
17 var content = new io.File(jsonPath).readAsStringSync(); | 18 var content = new io.File(jsonPath).readAsStringSync(); |
18 if (messagesAsJson != content) { | 19 if (messagesAsJson != content) { |
19 print("The content of the Dart messages and the corresponding JSON file"); | 20 print("The content of the Dart messages and the corresponding JSON file"); |
20 print("is not the same."); | 21 print("is not the same."); |
21 print("Please run bin/publish.dart to update the JSON file."); | 22 print("Please run bin/publish.dart to update the JSON file."); |
22 throw "Content is not the same"; | 23 throw "Content is not the same"; |
23 } | 24 } |
24 } | 25 } |
25 | 26 |
(...skipping 21 matching lines...) Expand all Loading... |
47 throw "Specialization doesn't have same id: $id - $genericId"; | 48 throw "Specialization doesn't have same id: $id - $genericId"; |
48 } | 49 } |
49 } | 50 } |
50 } | 51 } |
51 | 52 |
52 void main() { | 53 void main() { |
53 testJsonIsUpdated(); | 54 testJsonIsUpdated(); |
54 testIdsAreUnique(); | 55 testIdsAreUnique(); |
55 testSpecializationsAreOfSameId(); | 56 testSpecializationsAreOfSameId(); |
56 } | 57 } |
OLD | NEW |