Chromium Code Reviews| 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 SharedMessageKind; |
| 12 | 12 |
| 13 import 'message_kind_helper.dart'; | 13 import 'message_kind_helper.dart'; |
| 14 | 14 |
| 15 main(List<String> arguments) { | 15 main(List<String> arguments) { |
| 16 List<MessageTemplate> examples = <MessageTemplate>[]; | 16 List<MessageTemplate> examples = <MessageTemplate>[]; |
| 17 List allMessageKinds = | 17 List allMessageKinds = [] |
| 18 MessageKind.values.toList()..addAll(SharedMessageKind.values); | 18 ..addAll(MessageKind.values) |
| 19 ..addAll(SharedMessageKind.values); | |
|
Lasse Reichstein Nielsen
2016/01/25 13:44:01
Wouldn't it be great if we had List.operator+? :)
| |
| 19 for (var kind in allMessageKinds) { | 20 for (var kind in allMessageKinds) { |
| 20 if (kind == SharedMessageKind.exampleMessage) continue; | 21 if (kind == SharedMessageKind.exampleMessage) continue; |
| 21 | 22 |
| 22 MessageTemplate template = MessageTemplate.TEMPLATES[kind]; | 23 MessageTemplate template = MessageTemplate.TEMPLATES[kind]; |
| 23 Expect.isNotNull(template, "No template for $kind."); | 24 Expect.isNotNull(template, "No template for $kind."); |
| 24 Expect.equals(kind, template.kind, | 25 Expect.equals(kind, template.kind, |
| 25 "Invalid MessageTemplate.kind for $kind, found ${template.kind}."); | 26 "Invalid MessageTemplate.kind for $kind, found ${template.kind}."); |
| 26 | 27 |
| 27 String name = '${kind.toString()}'.substring('MessageKind.'.length); | 28 String name = '${kind.toString()}'.substring('MessageKind.'.length); |
| 28 if (!arguments.isEmpty && !arguments.contains(name)) continue; | 29 if (!arguments.isEmpty && !arguments.contains(name)) continue; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 48 asyncTest(() => Future.forEach(examples, (MessageTemplate template) { | 49 asyncTest(() => Future.forEach(examples, (MessageTemplate template) { |
| 49 print("Checking '${template.kind}'."); | 50 print("Checking '${template.kind}'."); |
| 50 Stopwatch sw = new Stopwatch()..start(); | 51 Stopwatch sw = new Stopwatch()..start(); |
| 51 return check(template, cachedCompiler).then((var compiler) { | 52 return check(template, cachedCompiler).then((var compiler) { |
| 52 cachedCompiler = compiler; | 53 cachedCompiler = compiler; |
| 53 sw.stop(); | 54 sw.stop(); |
| 54 print("Checked '${template.kind}' in ${sw.elapsedMilliseconds}ms."); | 55 print("Checked '${template.kind}' in ${sw.elapsedMilliseconds}ms."); |
| 55 }); | 56 }); |
| 56 })); | 57 })); |
| 57 } | 58 } |
| OLD | NEW |