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

Side by Side Diff: pkg/dev_compiler/test/codegen_test.dart

Issue 2797443007: fix #29182, generate top level const fields lazily (Closed)
Patch Set: fix Created 3 years, 8 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 /// Tests code generation. 5 /// Tests code generation.
6 /// 6 ///
7 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks 7 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks
8 /// that the output is what we expected. 8 /// that the output is what we expected.
9 library dev_compiler.test.codegen_test; 9 library dev_compiler.test.codegen_test;
10 10
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 var files = new Set<String>(); 149 var files = new Set<String>();
150 _collectTransitiveImports(contents, files, from: testFile); 150 _collectTransitiveImports(contents, files, from: testFile);
151 var unit = new BuildUnit( 151 var unit = new BuildUnit(
152 name, path.dirname(testFile), files.toList(), _moduleForLibrary); 152 name, path.dirname(testFile), files.toList(), _moduleForLibrary);
153 153
154 var compiler = sharedCompiler; 154 var compiler = sharedCompiler;
155 if (analyzerOptions.declaredVariables.isNotEmpty) { 155 if (analyzerOptions.declaredVariables.isNotEmpty) {
156 compiler = new ModuleCompiler(analyzerOptions); 156 compiler = new ModuleCompiler(analyzerOptions);
157 } 157 }
158 JSModuleFile module = null; 158 JSModuleFile module = null;
159 var exception, stackTrace;
159 try { 160 try {
160 module = compiler.compile(unit, options); 161 module = compiler.compile(unit, options);
161 } catch (e) {} 162 } catch (e, st) {
163 exception = e;
164 stackTrace = st;
165 }
162 166
163 bool expectedCompileTimeError = 167 bool expectedCompileTimeError =
164 contents.contains(': compile-time error\n'); 168 contents.contains(': compile-time error\n');
165 bool notStrong = notYetStrongTests.contains(name); 169 bool notStrong = notYetStrongTests.contains(name);
166 bool crashing = _crashingTests.contains(name); 170 bool crashing = _crashingTests.contains(name);
167 171
168 if (module == null) { 172 if (module == null) {
169 expect(crashing, isTrue, 173 expect(crashing, isTrue,
170 reason: "test $name crashes during compilation."); 174 reason: "test $name crashes during compilation.\n"
175 "$exception\n$stackTrace");
171 } else if (module.isValid) { 176 } else if (module.isValid) {
172 _writeModule( 177 _writeModule(
173 path.join(codegenOutputDir, name), 178 path.join(codegenOutputDir, name),
174 isTopLevelTest ? path.join(codegenExpectDir, name) : null, 179 isTopLevelTest ? path.join(codegenExpectDir, name) : null,
175 moduleFormat, 180 moduleFormat,
176 module); 181 module);
177 182
178 expect(crashing, isFalse, reason: "test $name no longer crashes."); 183 expect(crashing, isFalse, reason: "test $name no longer crashes.");
179 // TODO(vsm): We don't seem to trip on non-strong errors? 184 // TODO(vsm): We don't seem to trip on non-strong errors?
180 // expect(expectedCompileTimeError, isFalse, 185 // expect(expectedCompileTimeError, isFalse,
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 394
390 // TODO(vsm): Fix these - they import files from a different directory 395 // TODO(vsm): Fix these - they import files from a different directory
391 // - this triggers an invalid library root build error. 396 // - this triggers an invalid library root build error.
392 'lib/html/custom/attribute_changed_callback_test', 397 'lib/html/custom/attribute_changed_callback_test',
393 'lib/html/custom/constructor_calls_created_synchronously_test', 398 'lib/html/custom/constructor_calls_created_synchronously_test',
394 'lib/html/custom/entered_left_view_test', 399 'lib/html/custom/entered_left_view_test',
395 'lib/html/custom/js_custom_test', 400 'lib/html/custom/js_custom_test',
396 'lib/html/custom/mirrors_test', 401 'lib/html/custom/mirrors_test',
397 'lib/html/custom/regress_194523002_test', 402 'lib/html/custom/regress_194523002_test',
398 ]); 403 ]);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698