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 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
6 import 'dart:async'; | 6 import 'dart:async'; |
7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
8 import 'package:compiler/src/diagnostics/messages.dart' show | 8 import 'package:compiler/src/diagnostics/messages.dart' show |
9 MessageKind, | 9 MessageKind, |
10 MessageTemplate; | 10 MessageTemplate, |
| 11 SharedMessageKind; |
11 | 12 |
12 import 'message_kind_helper.dart'; | 13 import 'message_kind_helper.dart'; |
13 | 14 |
14 main(List<String> arguments) { | 15 main(List<String> arguments) { |
15 List<MessageTemplate> examples = <MessageTemplate>[]; | 16 List<MessageTemplate> examples = <MessageTemplate>[]; |
16 for (MessageKind kind in MessageKind.values) { | 17 List allMessageKinds = |
| 18 MessageKind.values.toList()..addAll(SharedMessageKind.values); |
| 19 for (var kind in allMessageKinds) { |
| 20 if (kind == SharedMessageKind.exampleMessage) continue; |
| 21 |
17 MessageTemplate template = MessageTemplate.TEMPLATES[kind]; | 22 MessageTemplate template = MessageTemplate.TEMPLATES[kind]; |
18 Expect.isNotNull(template, "No template for $kind."); | 23 Expect.isNotNull(template, "No template for $kind."); |
19 Expect.equals(kind, template.kind, | 24 Expect.equals(kind, template.kind, |
20 "Invalid MessageTemplate.kind for $kind, found ${template.kind}."); | 25 "Invalid MessageTemplate.kind for $kind, found ${template.kind}."); |
21 | 26 |
22 String name = '${kind.toString()}'.substring('MessageKind.'.length); | 27 String name = '${kind.toString()}'.substring('MessageKind.'.length); |
23 if (!arguments.isEmpty && !arguments.contains(name)) continue; | 28 if (!arguments.isEmpty && !arguments.contains(name)) continue; |
24 if (name == 'GENERIC' // Shouldn't be used. | 29 if (name == 'GENERIC' // Shouldn't be used. |
25 // We can't provoke a crash. | 30 // We can't provoke a crash. |
26 || name == 'COMPILER_CRASHED' | 31 || name == 'COMPILER_CRASHED' |
(...skipping 16 matching lines...) Expand all Loading... |
43 asyncTest(() => Future.forEach(examples, (MessageTemplate template) { | 48 asyncTest(() => Future.forEach(examples, (MessageTemplate template) { |
44 print("Checking '${template.kind}'."); | 49 print("Checking '${template.kind}'."); |
45 Stopwatch sw = new Stopwatch()..start(); | 50 Stopwatch sw = new Stopwatch()..start(); |
46 return check(template, cachedCompiler).then((var compiler) { | 51 return check(template, cachedCompiler).then((var compiler) { |
47 cachedCompiler = compiler; | 52 cachedCompiler = compiler; |
48 sw.stop(); | 53 sw.stop(); |
49 print("Checked '${template.kind}' in ${sw.elapsedMilliseconds}ms."); | 54 print("Checked '${template.kind}' in ${sw.elapsedMilliseconds}ms."); |
50 }); | 55 }); |
51 })); | 56 })); |
52 } | 57 } |
OLD | NEW |