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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 path.join('lib', 'math'), | 87 path.join('lib', 'math'), |
88 path.join('lib', 'typed_data'), | 88 path.join('lib', 'typed_data'), |
89 ]; | 89 ]; |
90 | 90 |
91 // Copy all of the test files and expanded multitest files to | 91 // Copy all of the test files and expanded multitest files to |
92 // gen/codegen_tests. We'll compile from there. | 92 // gen/codegen_tests. We'll compile from there. |
93 var testFiles = _setUpTests(testDirs); | 93 var testFiles = _setUpTests(testDirs); |
94 | 94 |
95 // Our default compiler options. Individual tests can override these. | 95 // Our default compiler options. Individual tests can override these. |
96 var defaultOptions = ['--no-source-map', '--no-summarize']; | 96 var defaultOptions = ['--no-source-map', '--no-summarize']; |
97 var compilerArgParser = CompilerOptions.addArguments(new ArgParser()); | 97 var compilerArgParser = new ArgParser(); |
| 98 CompilerOptions.addArguments(compilerArgParser); |
98 | 99 |
99 // Compile each test file to JS and put the result in gen/codegen_output. | 100 // Compile each test file to JS and put the result in gen/codegen_output. |
100 for (var testFile in testFiles) { | 101 for (var testFile in testFiles) { |
101 var relativePath = path.relative(testFile, from: codegenTestDir); | 102 var relativePath = path.relative(testFile, from: codegenTestDir); |
102 | 103 |
103 // Only compile the top-level files for generating coverage. | 104 // Only compile the top-level files for generating coverage. |
104 if (codeCoverage && path.dirname(relativePath) != ".") continue; | 105 if (codeCoverage && path.dirname(relativePath) != ".") continue; |
105 | 106 |
106 var name = path.withoutExtension(relativePath); | 107 var name = path.withoutExtension(relativePath); |
107 test('dartdevc $name', () { | 108 test('dartdevc $name', () { |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 /// Simplified from ParseDartTask.resolveDirective. | 341 /// Simplified from ParseDartTask.resolveDirective. |
341 String _resolveDirective(UriBasedDirective directive) { | 342 String _resolveDirective(UriBasedDirective directive) { |
342 StringLiteral uriLiteral = directive.uri; | 343 StringLiteral uriLiteral = directive.uri; |
343 String uriContent = uriLiteral.stringValue; | 344 String uriContent = uriLiteral.stringValue; |
344 if (uriContent != null) { | 345 if (uriContent != null) { |
345 uriContent = uriContent.trim(); | 346 uriContent = uriContent.trim(); |
346 directive.uriContent = uriContent; | 347 directive.uriContent = uriContent; |
347 } | 348 } |
348 return directive.validate() == null ? uriContent : null; | 349 return directive.validate() == null ? uriContent : null; |
349 } | 350 } |
OLD | NEW |