Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: tests/compiler/dart2js/message_kind_test.dart

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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'
9 MessageKind, 9 show MessageKind, MessageTemplate;
10 MessageTemplate;
11 10
12 import 'message_kind_helper.dart'; 11 import 'message_kind_helper.dart';
13 12
14 main(List<String> arguments) { 13 main(List<String> arguments) {
15 List<MessageTemplate> examples = <MessageTemplate>[]; 14 List<MessageTemplate> examples = <MessageTemplate>[];
16 for (var kind in MessageKind.values) { 15 for (var kind in MessageKind.values) {
17 MessageTemplate template = MessageTemplate.TEMPLATES[kind]; 16 MessageTemplate template = MessageTemplate.TEMPLATES[kind];
18 Expect.isNotNull(template, "No template for $kind."); 17 Expect.isNotNull(template, "No template for $kind.");
19 Expect.equals(kind, template.kind, 18 Expect.equals(kind, template.kind,
20 "Invalid MessageTemplate.kind for $kind, found ${template.kind}."); 19 "Invalid MessageTemplate.kind for $kind, found ${template.kind}.");
21 20
22 String name = '${kind.toString()}'.substring('MessageKind.'.length); 21 String name = '${kind.toString()}'.substring('MessageKind.'.length);
23 if (!arguments.isEmpty && !arguments.contains(name)) continue; 22 if (!arguments.isEmpty && !arguments.contains(name)) continue;
24 if (name == 'GENERIC' // Shouldn't be used. 23 if (name == 'GENERIC' // Shouldn't be used.
25 // We can't provoke a crash. 24 // We can't provoke a crash.
26 || name == 'COMPILER_CRASHED' 25 ||
27 || name == 'PLEASE_REPORT_THE_CRASH' 26 name == 'COMPILER_CRASHED' ||
27 name == 'PLEASE_REPORT_THE_CRASH'
28 // We cannot provide examples for patch errors. 28 // We cannot provide examples for patch errors.
29 || name.startsWith('PATCH_') 29 ||
30 || name == 'LIBRARY_NOT_SUPPORTED' 30 name.startsWith('PATCH_') ||
31 name == 'LIBRARY_NOT_SUPPORTED'
31 // TODO(johnniwinther): Remove these when [Compiler.reportUnusedCode] is 32 // TODO(johnniwinther): Remove these when [Compiler.reportUnusedCode] is
32 // reenabled. 33 // reenabled.
33 || name == 'UNUSED_METHOD' 34 ||
34 || name == 'UNUSED_CLASS' 35 name == 'UNUSED_METHOD' ||
35 || name == 'UNUSED_TYPEDEF') continue; 36 name == 'UNUSED_CLASS' ||
37 name == 'UNUSED_TYPEDEF') continue;
36 if (template.examples != null) { 38 if (template.examples != null) {
37 examples.add(template); 39 examples.add(template);
38 } else { 40 } else {
39 print("No example in '$name'"); 41 print("No example in '$name'");
40 } 42 }
41 }; 43 }
44 ;
42 var cachedCompiler; 45 var cachedCompiler;
43 asyncTest(() => Future.forEach(examples, (MessageTemplate template) { 46 asyncTest(() => Future.forEach(examples, (MessageTemplate template) {
44 print("Checking '${template.kind}'."); 47 print("Checking '${template.kind}'.");
45 Stopwatch sw = new Stopwatch()..start(); 48 Stopwatch sw = new Stopwatch()..start();
46 return check(template, cachedCompiler).then((var compiler) { 49 return check(template, cachedCompiler).then((var compiler) {
47 cachedCompiler = compiler; 50 cachedCompiler = compiler;
48 sw.stop(); 51 sw.stop();
49 print("Checked '${template.kind}' in ${sw.elapsedMilliseconds}ms."); 52 print("Checked '${template.kind}' in ${sw.elapsedMilliseconds}ms.");
50 }); 53 });
51 })); 54 }));
52 } 55 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/message_kind_helper.dart ('k') | tests/compiler/dart2js/message_span_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698