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 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks | 6 /// Runs Dart Dev Compiler on all input in the `codegen` directory and checks |
7 /// that the output is what we expected. | 7 /// that the output is what we expected. |
8 library dev_compiler.test.codegen_test; | 8 library dev_compiler.test.codegen_test; |
9 | 9 |
10 import 'dart:convert' show JSON; | 10 import 'dart:convert' show JSON; |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 final ArgParser argParser = new ArgParser() | 32 final ArgParser argParser = new ArgParser() |
33 ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null); | 33 ..addOption('dart-sdk', help: 'Dart SDK Path', defaultsTo: null); |
34 | 34 |
35 main(arguments) { | 35 main(arguments) { |
36 if (arguments == null) arguments = []; | 36 if (arguments == null) arguments = []; |
37 ArgResults args = argParser.parse(arguments); | 37 ArgResults args = argParser.parse(arguments); |
38 var filePattern = new RegExp(args.rest.length > 0 ? args.rest[0] : '.'); | 38 var filePattern = new RegExp(args.rest.length > 0 ? args.rest[0] : '.'); |
39 | 39 |
40 var expectDir = path.join(inputDir, 'expect'); | 40 var expectDir = path.join(inputDir, 'expect'); |
41 var testDirs = ['language', path.join('lib', 'typed_data')]; | 41 var testDirs = [ |
| 42 'language', |
| 43 path.join('lib', 'typed_data'), |
| 44 path.join('lib', 'html') |
| 45 ]; |
42 | 46 |
43 var multitests = expandMultiTests(testDirs, filePattern); | 47 var multitests = expandMultiTests(testDirs, filePattern); |
44 | 48 |
45 // Build packages tests depend on | 49 // Build packages tests depend on |
46 var compiler = new ModuleCompiler( | 50 var compiler = new ModuleCompiler( |
47 new AnalyzerOptions(customUrlMappings: packageUrlMappings)); | 51 new AnalyzerOptions(customUrlMappings: packageUrlMappings)); |
48 | 52 |
49 group('dartdevc package', () { | 53 group('dartdevc package', () { |
50 _buildPackages(compiler, expectDir); | 54 _buildPackages(compiler, expectDir); |
51 | 55 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 225 } |
222 return multitests; | 226 return multitests; |
223 } | 227 } |
224 | 228 |
225 // TODO(jmesserly): switch this to a .packages file. | 229 // TODO(jmesserly): switch this to a .packages file. |
226 final packageUrlMappings = { | 230 final packageUrlMappings = { |
227 'package:expect/expect.dart': path.join(inputDir, 'expect.dart'), | 231 'package:expect/expect.dart': path.join(inputDir, 'expect.dart'), |
228 'package:async_helper/async_helper.dart': | 232 'package:async_helper/async_helper.dart': |
229 path.join(inputDir, 'async_helper.dart'), | 233 path.join(inputDir, 'async_helper.dart'), |
230 'package:unittest/unittest.dart': path.join(inputDir, 'unittest.dart'), | 234 'package:unittest/unittest.dart': path.join(inputDir, 'unittest.dart'), |
| 235 'package:unittest/html_config.dart': path.join(inputDir, 'html_config.dart'), |
231 'package:js/js.dart': path.join(inputDir, 'packages', 'js', 'js.dart') | 236 'package:js/js.dart': path.join(inputDir, 'packages', 'js', 'js.dart') |
232 }; | 237 }; |
233 | 238 |
234 final codeCoverage = Platform.environment.containsKey('COVERALLS_TOKEN'); | 239 final codeCoverage = Platform.environment.containsKey('COVERALLS_TOKEN'); |
235 | 240 |
236 final inputDir = path.join(testDirectory, 'codegen'); | 241 final inputDir = path.join(testDirectory, 'codegen'); |
237 | 242 |
238 Iterable<String> _findTests(String dir, RegExp filePattern) { | 243 Iterable<String> _findTests(String dir, RegExp filePattern) { |
239 var files = new Directory(dir) | 244 var files = new Directory(dir) |
240 .listSync() | 245 .listSync() |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 /// Simplified from ParseDartTask.resolveDirective. | 287 /// Simplified from ParseDartTask.resolveDirective. |
283 String _resolveDirective(UriBasedDirective directive) { | 288 String _resolveDirective(UriBasedDirective directive) { |
284 StringLiteral uriLiteral = directive.uri; | 289 StringLiteral uriLiteral = directive.uri; |
285 String uriContent = uriLiteral.stringValue; | 290 String uriContent = uriLiteral.stringValue; |
286 if (uriContent != null) { | 291 if (uriContent != null) { |
287 uriContent = uriContent.trim(); | 292 uriContent = uriContent.trim(); |
288 directive.uriContent = uriContent; | 293 directive.uriContent = uriContent; |
289 } | 294 } |
290 return directive.validate() == null ? uriContent : null; | 295 return directive.validate() == null ? uriContent : null; |
291 } | 296 } |
OLD | NEW |