| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 _collectTransitiveImports(contents, files, from: testFile); | 124 _collectTransitiveImports(contents, files, from: testFile); |
| 125 var unit = new BuildUnit( | 125 var unit = new BuildUnit( |
| 126 name, path.dirname(testFile), files.toList(), _moduleForLibrary); | 126 name, path.dirname(testFile), files.toList(), _moduleForLibrary); |
| 127 var module = compiler.compile(unit, options); | 127 var module = compiler.compile(unit, options); |
| 128 _writeModule(path.join(codegenOutputDir, name), | 128 _writeModule(path.join(codegenOutputDir, name), |
| 129 isTopLevelTest ? path.join(codegenExpectDir, name) : null, module); | 129 isTopLevelTest ? path.join(codegenExpectDir, name) : null, module); |
| 130 }); | 130 }); |
| 131 } | 131 } |
| 132 | 132 |
| 133 if (filePattern.hasMatch('sunflower')) { | 133 if (filePattern.hasMatch('sunflower')) { |
| 134 _buildSunflower(compiler, codegenOutputDir, codegenExpectDir); | 134 test('sunflower', () { |
| 135 _buildSunflower(compiler, codegenOutputDir, codegenExpectDir); |
| 136 }); |
| 135 } | 137 } |
| 136 | 138 |
| 137 if (codeCoverage) { | 139 if (codeCoverage) { |
| 138 test('build_sdk code coverage', () { | 140 test('build_sdk code coverage', () { |
| 139 return build_sdk.main(['--dart-sdk', sdkDir, '-o', codegenOutputDir]); | 141 return build_sdk.main(['--dart-sdk', sdkDir, '-o', codegenOutputDir]); |
| 140 }); | 142 }); |
| 141 } | 143 } |
| 142 } | 144 } |
| 143 | 145 |
| 144 void _writeModule(String outPath, String expectPath, JSModuleFile result) { | 146 void _writeModule(String outPath, String expectPath, JSModuleFile result) { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 /// Simplified from ParseDartTask.resolveDirective. | 344 /// Simplified from ParseDartTask.resolveDirective. |
| 343 String _resolveDirective(UriBasedDirective directive) { | 345 String _resolveDirective(UriBasedDirective directive) { |
| 344 StringLiteral uriLiteral = directive.uri; | 346 StringLiteral uriLiteral = directive.uri; |
| 345 String uriContent = uriLiteral.stringValue; | 347 String uriContent = uriLiteral.stringValue; |
| 346 if (uriContent != null) { | 348 if (uriContent != null) { |
| 347 uriContent = uriContent.trim(); | 349 uriContent = uriContent.trim(); |
| 348 directive.uriContent = uriContent; | 350 directive.uriContent = uriContent; |
| 349 } | 351 } |
| 350 return directive.validate() == null ? uriContent : null; | 352 return directive.validate() == null ? uriContent : null; |
| 351 } | 353 } |
| OLD | NEW |