Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Side by Side Diff: pkg/front_end/test/fasta/shaker_test.dart

Issue 2895983002: Read SDK and patches from a JSON file. (Closed)
Patch Set: Merged with 1333f97b9a0e3805f991578ef83b0ec4553ecf33 Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 return loadProgramFromBytes(outlineBytes); 68 return loadProgramFromBytes(outlineBytes);
69 } 69 }
70 70
71 static create(Map<String, String> environment) async { 71 static create(Map<String, String> environment) async {
72 environment[ENABLE_FULL_COMPILE] = ""; 72 environment[ENABLE_FULL_COMPILE] = "";
73 environment[AST_KIND_INDEX] = "${AstKind.Kernel.index}"; 73 environment[AST_KIND_INDEX] = "${AstKind.Kernel.index}";
74 bool updateExpectations = environment["updateExpectations"] == "true"; 74 bool updateExpectations = environment["updateExpectations"] == "true";
75 Uri sdk = await computePatchedSdk(); 75 Uri sdk = await computePatchedSdk();
76 Uri outlineUri = sdk.resolve('outline.dill'); 76 Uri outlineUri = sdk.resolve('outline.dill');
77 Uri packages = Uri.base.resolve(".packages"); 77 Uri packages = Uri.base.resolve(".packages");
78 TranslateUri uriTranslator = 78 TranslateUri uriTranslator = await TranslateUri
79 await TranslateUri.parse(PhysicalFileSystem.instance, packages); 79 .parse(PhysicalFileSystem.instance, sdk, packages: packages);
80 List<int> outlineBytes = new File.fromUri(outlineUri).readAsBytesSync(); 80 List<int> outlineBytes = new File.fromUri(outlineUri).readAsBytesSync();
81 return new TreeShakerContext( 81 return new TreeShakerContext(
82 outlineUri, uriTranslator, outlineBytes, updateExpectations); 82 outlineUri, uriTranslator, outlineBytes, updateExpectations);
83 } 83 }
84 } 84 }
85 85
86 /// Step that extracts the test-specific options and builds the program without 86 /// Step that extracts the test-specific options and builds the program without
87 /// applying tree-shaking. 87 /// applying tree-shaking.
88 class BuildProgram 88 class BuildProgram
89 extends Step<TestDescription, _IntermediateData, TreeShakerContext> { 89 extends Step<TestDescription, _IntermediateData, TreeShakerContext> {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 """ 232 """
233 Please create file ${expectedFile.path} with this content: 233 Please create file ${expectedFile.path} with this content:
234 $buffer"""); 234 $buffer""");
235 } 235 }
236 } 236 }
237 } 237 }
238 238
239 /// A special library used only to test the shaker. The suite above will 239 /// A special library used only to test the shaker. The suite above will
240 /// tree-shake the contents of this library. 240 /// tree-shake the contents of this library.
241 const _specialLibraryPath = 'pkg/front_end/testcases/shaker/lib/lib.dart'; 241 const _specialLibraryPath = 'pkg/front_end/testcases/shaker/lib/lib.dart';
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/translate_uri.dart ('k') | pkg/front_end/test/fasta/testing/suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698