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

Side by Side Diff: pkg/front_end/test/kernel_generator_test.dart

Issue 3003743002: Move tools to tool folder. (Closed)
Patch Set: Created 3 years, 4 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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:front_end/front_end.dart'; 5 import 'package:front_end/front_end.dart';
6 import 'package:front_end/src/fasta/fasta_codes.dart'; 6 import 'package:front_end/src/fasta/fasta_codes.dart';
7 import 'package:front_end/src/fasta/kernel/utils.dart'; 7 import 'package:front_end/src/fasta/kernel/utils.dart';
8 import 'package:front_end/src/fasta/deprecated_problems.dart' 8 import 'package:front_end/src/fasta/deprecated_problems.dart'
9 show deprecated_InputError; 9 show deprecated_InputError;
10 import 'package:front_end/src/testing/compiler_common.dart'; 10 import 'package:front_end/src/testing/compiler_common.dart';
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 expect(printMember.function.body is EmptyStatement, isTrue); 56 expect(printMember.function.body is EmptyStatement, isTrue);
57 }); 57 });
58 58
59 test('compiler requires a main method', () async { 59 test('compiler requires a main method', () async {
60 var errors = []; 60 var errors = [];
61 var options = new CompilerOptions()..onError = (e) => errors.add(e); 61 var options = new CompilerOptions()..onError = (e) => errors.add(e);
62 await compileScript('a() => print("hi");', options: options); 62 await compileScript('a() => print("hi");', options: options);
63 expect(errors.first.message, messageMissingMain.message); 63 expect(errors.first.message, messageMissingMain.message);
64 }); 64 });
65 65
66 test('default error handler throws on errors', () async { 66 // TODO(ahe): This test is wrong at least with respect to expecting that
67 var options = new CompilerOptions(); 67 // [deprecated_InputError] leaks through the API. Furthermore, the default
68 var exceptionThrown = false; 68 // behavior should be to recover from errors, as this is the most important
69 try { 69 // use case we have.
ahe 2017/08/23 15:07:18 Please let me know if I can delete this test? If
Siggi Cherem (dart-lang) 2017/08/23 20:17:35 I'd like to keep something to test a default-error
ahe 2017/08/24 11:52:02 I'd rather wait until you have time to implement t
70 await compileScript('a() => print("hi");', options: options); 70 // ignore: DEAD_CODE
71 } on deprecated_InputError catch (e) { 71 if (false) {
Siggi Cherem (dart-lang) 2017/08/23 20:17:35 Might not be relevant depending on how we address
ahe 2017/08/24 11:52:02 Done.
72 exceptionThrown = true; 72 test('default error handler throws on errors', () async {
73 expect('${e.error}', contains("Compilation aborted")); 73 var options = new CompilerOptions();
74 } 74 var exceptionThrown = false;
75 expect(exceptionThrown, isTrue); 75 try {
76 }); 76 await compileScript('a() => print("hi");', options: options);
77 } on deprecated_InputError catch (e) {
78 exceptionThrown = true;
79 expect('${e.error}', contains("Compilation aborted"));
80 }
81 expect(exceptionThrown, isTrue);
82 });
83 }
77 84
78 test('generated program contains source-info', () async { 85 test('generated program contains source-info', () async {
79 var program = await compileScript('a() => print("hi"); main() {}', 86 var program = await compileScript('a() => print("hi"); main() {}',
80 fileName: 'a.dart'); 87 fileName: 'a.dart');
81 // Kernel always store an empty '' key in the map, so there is always at 88 // Kernel always store an empty '' key in the map, so there is always at
82 // least one. Having more means that source-info is added. 89 // least one. Having more means that source-info is added.
83 expect(program.uriToSource.keys.length, greaterThan(1)); 90 expect(program.uriToSource.keys.length, greaterThan(1));
84 expect(program.uriToSource['file:///a/b/c/a.dart'], isNotNull); 91 expect(program.uriToSource['file:///a/b/c/a.dart'], isNotNull);
85 }); 92 });
86 93
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 checkDCallsC(unitD1); 213 checkDCallsC(unitD1);
207 214
208 var unitD2 = await compileUnit(['d.dart'], sources, 215 var unitD2 = await compileUnit(['d.dart'], sources,
209 inputSummaries: ['bc.dill', 'a.dill']); 216 inputSummaries: ['bc.dill', 'a.dill']);
210 checkDCallsC(unitD2); 217 checkDCallsC(unitD2);
211 }); 218 });
212 219
213 // TODO(sigmund): add tests with trimming dependencies 220 // TODO(sigmund): add tests with trimming dependencies
214 }); 221 });
215 } 222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698