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

Side by Side Diff: test/codegen_test.dart

Issue 1788973002: Remove code that requires whole-program compile (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged Created 4 years, 9 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
« no previous file with comments | « test/all_tests.dart ('k') | test/dependency_graph_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// Tests code generation. 5 /// Tests code generation.
6 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks 6 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks
7 /// that the output is what we expected. 7 /// that the output is what we expected.
8 library dev_compiler.test.codegen_test; 8 library dev_compiler.test.codegen_test;
9 9
10 import 'dart:io'; 10 import 'dart:io';
11 import 'package:analyzer/src/generated/engine.dart' 11 import 'package:analyzer/src/generated/engine.dart'
12 show AnalysisContext, AnalysisEngine, Logger; 12 show AnalysisContext, AnalysisEngine, Logger;
13 import 'package:analyzer/src/generated/java_engine.dart' show CaughtException; 13 import 'package:analyzer/src/generated/java_engine.dart' show CaughtException;
14 import 'package:args/args.dart'; 14 import 'package:args/args.dart';
15 import 'package:logging/logging.dart' show Level; 15 import 'package:logging/logging.dart' show Level;
16 import 'package:path/path.dart' as path; 16 import 'package:path/path.dart' as path;
17 import 'package:test/test.dart'; 17 import 'package:test/test.dart';
18 18
19 import 'package:dev_compiler/devc.dart'; 19 import 'package:dev_compiler/devc.dart';
20 import 'package:dev_compiler/src/compiler.dart' show defaultRuntimeFiles; 20 import 'package:dev_compiler/src/compiler.dart' show defaultRuntimeFiles;
21 import 'package:dev_compiler/src/options.dart'; 21 import 'package:dev_compiler/src/options.dart';
22 import 'package:dev_compiler/src/report.dart' show LogReporter;
22 23
23 import 'testing.dart' show realSdkContext, testDirectory; 24 import 'testing.dart' show realSdkContext, testDirectory;
24 import 'multitest.dart'; 25 import 'multitest.dart';
25 26
26 final ArgParser argParser = new ArgParser() 27 final ArgParser argParser = new ArgParser()
27 ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null); 28 ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null);
28 29
29 final inputDir = path.join(testDirectory, 'codegen'); 30 final inputDir = path.join(testDirectory, 'codegen');
30 31
31 Iterable<String> _findTests(String dir, RegExp filePattern) { 32 Iterable<String> _findTests(String dir, RegExp filePattern) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 outputDir: expectDir, 79 outputDir: expectDir,
79 emitSourceMaps: sourceMaps, 80 emitSourceMaps: sourceMaps,
80 closure: closure, 81 closure: closure,
81 destructureNamedParams: destructureNamedParams, 82 destructureNamedParams: destructureNamedParams,
82 forceCompile: checkSdk, 83 forceCompile: checkSdk,
83 moduleFormat: moduleFormat), 84 moduleFormat: moduleFormat),
84 useColors: false, 85 useColors: false,
85 checkSdk: checkSdk, 86 checkSdk: checkSdk,
86 runtimeDir: runtimeDir, 87 runtimeDir: runtimeDir,
87 inputBaseDir: inputDir); 88 inputBaseDir: inputDir);
88 var reporter = createErrorReporter(context, options); 89 var reporter = new LogReporter(context);
89 return new BatchCompiler(context, options, reporter: reporter); 90 return new BatchCompiler(context, options, reporter: reporter);
90 } 91 }
91 92
92 bool compile(BatchCompiler compiler, String filePath) { 93 bool compile(BatchCompiler compiler, String filePath) {
93 compiler.compileFromUriString(filePath, (String url) { 94 compiler.compileFromUriString(filePath, (String url) {
94 // Write compiler messages to disk. 95 // Write compiler messages to disk.
95 var messagePath = '${path.withoutExtension(url)}.txt'; 96 var messagePath = '${path.withoutExtension(url)}.txt';
96 var file = new File(messagePath); 97 var file = new File(messagePath);
97 var message = ''' 98 var message = '''
98 // Messages from compiling ${path.basenameWithoutExtension(url)}.dart 99 // Messages from compiling ${path.basenameWithoutExtension(url)}.dart
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 /// An implementation of analysis engine's [Logger] that prints. 262 /// An implementation of analysis engine's [Logger] that prints.
262 class PrintLogger implements Logger { 263 class PrintLogger implements Logger {
263 @override 264 @override
264 void logError(String message, [CaughtException exception]) { 265 void logError(String message, [CaughtException exception]) {
265 print('[AnalysisEngine] error $message $exception'); 266 print('[AnalysisEngine] error $message $exception');
266 } 267 }
267 268
268 void logInformation(String message, [CaughtException exception]) {} 269 void logInformation(String message, [CaughtException exception]) {}
269 void logInformation2(String message, Object exception) {} 270 void logInformation2(String message, Object exception) {}
270 } 271 }
OLDNEW
« no previous file with comments | « test/all_tests.dart ('k') | test/dependency_graph_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698