OLD | NEW |
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 Loading... |
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 error, trace; | |
160 try { | 159 try { |
161 module = compiler.compile(unit, options); | 160 module = compiler.compile(unit, options); |
162 } catch (e, t) { | 161 } catch (e) {} |
163 error = e; | |
164 trace = t; | |
165 } | |
166 | 162 |
167 bool notStrong = notYetStrongTests.contains(name); | 163 bool notStrong = notYetStrongTests.contains(name); |
168 bool crashing = _crashingTests.contains(name); | 164 bool crashing = _crashingTests.contains(name); |
169 | 165 |
170 if (module == null) { | 166 if (module == null) { |
171 expect(crashing, isTrue, | 167 expect(crashing, isTrue, |
172 reason: "test $name crashes during compilation.\n\n" | 168 reason: "test $name crashes during compilation."); |
173 "Exception: $error\n\nStack trace:\n\n$trace"); | |
174 } else if (module.isValid) { | 169 } else if (module.isValid) { |
175 _writeModule( | 170 _writeModule( |
176 path.join(codegenOutputDir, name), | 171 path.join(codegenOutputDir, name), |
177 isTopLevelTest ? path.join(codegenExpectDir, name) : null, | 172 isTopLevelTest ? path.join(codegenExpectDir, name) : null, |
178 moduleFormat, | 173 moduleFormat, |
179 module); | 174 module); |
180 | 175 |
181 expect(crashing, isFalse, reason: "test $name no longer crashes."); | 176 expect(crashing, isFalse, reason: "test $name no longer crashes."); |
182 expect(notStrong, isFalse, | 177 expect(notStrong, isFalse, |
183 reason: "test $name expected strong mode errors, but compiled."); | 178 reason: "test $name expected strong mode errors, but compiled."); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 'language/mixin_illegal_syntax_test_14_multi', | 391 'language/mixin_illegal_syntax_test_14_multi', |
397 | 392 |
398 // TODO(vsm): Fix these - they import files from a different directory | 393 // TODO(vsm): Fix these - they import files from a different directory |
399 // - this triggers an invalid library root build error. | 394 // - this triggers an invalid library root build error. |
400 'lib/html/custom/attribute_changed_callback_test', | 395 'lib/html/custom/attribute_changed_callback_test', |
401 'lib/html/custom/entered_left_view_test', | 396 'lib/html/custom/entered_left_view_test', |
402 'lib/html/custom/js_custom_test', | 397 'lib/html/custom/js_custom_test', |
403 'lib/html/custom/mirrors_test', | 398 'lib/html/custom/mirrors_test', |
404 'lib/html/custom/regress_194523002_test', | 399 'lib/html/custom/regress_194523002_test', |
405 ]); | 400 ]); |
OLD | NEW |