| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
| 4 | 4 |
| 5 /// Tests basic functionality of the API tree-shaker. | 5 /// Tests basic functionality of the API tree-shaker. |
| 6 /// | 6 /// |
| 7 /// Each input file is built and tree-shaken, then we check that the set of | 7 /// Each input file is built and tree-shaken, then we check that the set of |
| 8 /// libraries, classes, and members that are retained match those declared in an | 8 /// libraries, classes, and members that are retained match those declared in an |
| 9 /// expectations file. | 9 /// expectations file. |
| 10 /// | 10 /// |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri; | 32 import 'package:front_end/src/fasta/translate_uri.dart' show TranslateUri; |
| 33 import 'package:front_end/src/fasta/util/relativize.dart' show relativizeUri; | 33 import 'package:front_end/src/fasta/util/relativize.dart' show relativizeUri; |
| 34 import 'package:kernel/ast.dart' show Program; | 34 import 'package:kernel/ast.dart' show Program; |
| 35 import 'package:kernel/kernel.dart' show loadProgramFromBytes; | 35 import 'package:kernel/kernel.dart' show loadProgramFromBytes; |
| 36 import 'package:kernel/target/targets.dart' show TargetFlags; | 36 import 'package:kernel/target/targets.dart' show TargetFlags; |
| 37 import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget; | 37 import 'package:kernel/target/vm_fasta.dart' show VmFastaTarget; |
| 38 import 'package:testing/testing.dart' | 38 import 'package:testing/testing.dart' |
| 39 show Chain, ChainContext, ExpectationSet, Result, Step, TestDescription; | 39 show Chain, ChainContext, ExpectationSet, Result, Step, TestDescription; |
| 40 import 'testing/suite.dart'; | 40 import 'testing/suite.dart'; |
| 41 | 41 |
| 42 main(List<String> arguments) => runMe(arguments, createContext, "testing.json"); | 42 main(List<String> arguments) => |
| 43 runMe(arguments, createContext, "../../testing.json"); |
| 43 | 44 |
| 44 Future<TreeShakerContext> createContext( | 45 Future<TreeShakerContext> createContext( |
| 45 Chain suite, Map<String, String> environment) { | 46 Chain suite, Map<String, String> environment) { |
| 46 return TreeShakerContext.create(environment); | 47 return TreeShakerContext.create(environment); |
| 47 } | 48 } |
| 48 | 49 |
| 49 /// Context used to run the tree-shaking test suite. | 50 /// Context used to run the tree-shaking test suite. |
| 50 class TreeShakerContext extends ChainContext { | 51 class TreeShakerContext extends ChainContext { |
| 51 final TranslateUri uriTranslator; | 52 final TranslateUri uriTranslator; |
| 52 final Uri outlineUri; | 53 final Uri outlineUri; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 """ | 237 """ |
| 237 Please create file ${expectedFile.path} with this content: | 238 Please create file ${expectedFile.path} with this content: |
| 238 $buffer"""); | 239 $buffer"""); |
| 239 } | 240 } |
| 240 } | 241 } |
| 241 } | 242 } |
| 242 | 243 |
| 243 /// A special library used only to test the shaker. The suite above will | 244 /// A special library used only to test the shaker. The suite above will |
| 244 /// tree-shake the contents of this library. | 245 /// tree-shake the contents of this library. |
| 245 const _specialLibraryPath = 'pkg/front_end/testcases/shaker/lib/lib.dart'; | 246 const _specialLibraryPath = 'pkg/front_end/testcases/shaker/lib/lib.dart'; |
| OLD | NEW |