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

Side by Side Diff: tests/compiler/dart2js/bad_loop_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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 'memory_source_file_helper.dart'; 6 import 'memory_source_file_helper.dart';
7 import "package:async_helper/async_helper.dart"; 7 import "package:async_helper/async_helper.dart";
8 8
9 import 'package:compiler/compiler.dart' 9 import 'package:compiler/compiler.dart' show Diagnostic;
10 show Diagnostic;
11 import 'package:compiler/src/options.dart' show CompilerOptions; 10 import 'package:compiler/src/options.dart' show CompilerOptions;
12 import 'package:compiler/src/old_to_new_api.dart'; 11 import 'package:compiler/src/old_to_new_api.dart';
13 12
14 main() { 13 main() {
15 Uri script = currentDirectory.resolveUri(Platform.script); 14 Uri script = currentDirectory.resolveUri(Platform.script);
16 Uri libraryRoot = script.resolve('../../../sdk/'); 15 Uri libraryRoot = script.resolve('../../../sdk/');
17 Uri packageRoot = script.resolve('./packages/'); 16 Uri packageRoot = script.resolve('./packages/');
18 17
19 var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES); 18 var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
20 int warningCount = 0; 19 int warningCount = 0;
21 int errorCount = 0; 20 int errorCount = 0;
22 void diagnosticHandler(Uri uri, int begin, int end, 21 void diagnosticHandler(
23 String message, Diagnostic kind) { 22 Uri uri, int begin, int end, String message, Diagnostic kind) {
24 if (kind == Diagnostic.VERBOSE_INFO) { 23 if (kind == Diagnostic.VERBOSE_INFO) {
25 return; 24 return;
26 } 25 }
27 if (kind == Diagnostic.ERROR) { 26 if (kind == Diagnostic.ERROR) {
28 errorCount++; 27 errorCount++;
29 } else if (kind == Diagnostic.WARNING) { 28 } else if (kind == Diagnostic.WARNING) {
30 warningCount++; 29 warningCount++;
31 } else { 30 } else {
32 throw 'unexpected diagnostic $kind: $message'; 31 throw 'unexpected diagnostic $kind: $message';
33 } 32 }
34 } 33 }
35 34
36 CompilerImpl compiler = new CompilerImpl( 35 CompilerImpl compiler = new CompilerImpl(
37 new LegacyCompilerInput(provider.readStringFromUri), 36 new LegacyCompilerInput(provider.readStringFromUri),
38 new LegacyCompilerOutput(), 37 new LegacyCompilerOutput(),
39 new LegacyCompilerDiagnostics(diagnosticHandler), 38 new LegacyCompilerDiagnostics(diagnosticHandler),
40 new CompilerOptions( 39 new CompilerOptions(libraryRoot: libraryRoot, packageRoot: packageRoot));
41 libraryRoot: libraryRoot,
42 packageRoot: packageRoot));
43 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { 40 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) {
44 Expect.isTrue(compiler.compilationFailed); 41 Expect.isTrue(compiler.compilationFailed);
45 Expect.equals(5, errorCount); 42 Expect.equals(5, errorCount);
46 Expect.equals(1, warningCount); 43 Expect.equals(1, warningCount);
47 })); 44 }));
48 } 45 }
49 46
50 const Map MEMORY_SOURCE_FILES = const { 47 const Map MEMORY_SOURCE_FILES = const {
51 'main.dart': """ 48 'main.dart': """
52 main() { 49 main() {
53 for (var x, y in []) { 50 for (var x, y in []) {
54 } 51 }
55 52
56 for (var x = 10 in []) { 53 for (var x = 10 in []) {
57 } 54 }
58 55
59 for (x.y in []) { // Also causes a warning "x unresolved". 56 for (x.y in []) { // Also causes a warning "x unresolved".
60 } 57 }
61 58
62 for ((){}() in []) { 59 for ((){}() in []) {
63 } 60 }
64 61
65 for (1 in []) { 62 for (1 in []) {
66 } 63 }
67 } 64 }
68 """ 65 """
69 }; 66 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/async_compiler_input_provider_test.dart ('k') | tests/compiler/dart2js/bad_output_io_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698