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

Side by Side Diff: tests/standalone/full_coverage_test.dart

Issue 1334353002: - Add getters for the current packageRoot or packageMap. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Updated documentation comment. Created 5 years, 3 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 // These tests fork a second VM process that runs the script 5 // These tests fork a second VM process that runs the script
6 // ``tools/full-coverage.dart'' and verifies that the tool 6 // ``tools/full-coverage.dart'' and verifies that the tool
7 // produces the expeced output. 7 // produces the expeced output.
8 8
9 import 'dart:async'; 9 import 'dart:async';
10 import 'dart:convert'; 10 import 'dart:convert';
11 import 'dart:io'; 11 import 'dart:io';
12 12
13 import 'package:path/path.dart' as path; 13 import 'package:path/path.dart' as path;
14 import 'package:unittest/unittest.dart'; 14 import 'package:unittest/unittest.dart';
15 15
16 final String coverageScript = 16 final String coverageScript =
17 Platform.script.resolve('../../tools/full-coverage.dart').toFilePath(); 17 Platform.script.resolve('../../tools/full-coverage.dart').toFilePath();
18 final String packageRoot = Platform.packageRoot; 18 String packageRoot;
19 final List dartBaseArgs = ['--package-root=${packageRoot}', '--checked',]; 19 final List dartBaseArgs = ['--package-root=${packageRoot}', '--checked',];
20 20
21 // With line numbers starting at 0, the list of hits can be understood as 21 // With line numbers starting at 0, the list of hits can be understood as
22 // follows: 22 // follows:
23 // * -1: No coverage data on this line. 23 // * -1: No coverage data on this line.
24 // * 0: No hits on this line. 24 // * 0: No hits on this line.
25 // * 1: ``Some'' hits on this line. 25 // * 1: ``Some'' hits on this line.
26 final coverageTests = [ 26 final coverageTests = [
27 { 27 {
28 'name': 'faculty', 28 'name': 'faculty',
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 expect(e, expectedHitMap.removeAt(0)); 203 expect(e, expectedHitMap.removeAt(0));
204 }); 204 });
205 // Make sure that there are only lines left that do not contain coverage 205 // Make sure that there are only lines left that do not contain coverage
206 // data. 206 // data.
207 expectedHitMap.forEach((e) => expect(e, -1)); 207 expectedHitMap.forEach((e) => expect(e, -1));
208 }), completes); 208 }), completes);
209 }), completes); 209 }), completes);
210 } 210 }
211 211
212 212
213 main() { 213 main() async {
214 String testingDirectory; 214 String testingDirectory;
215 215
216 packageRoot = (await Platform.packageRoot).toFilePath();
217
216 setUp(() { 218 setUp(() {
217 testingDirectory = prepareEnv(); 219 testingDirectory = prepareEnv();
218 }); 220 });
219 221
220 tearDown(() => destroyEnv(testingDirectory)); 222 tearDown(() => destroyEnv(testingDirectory));
221 223
222 test('CoverageTests', () { 224 test('CoverageTests', () {
223 generateCoverage(testingDirectory); 225 generateCoverage(testingDirectory);
224 226
225 coverageTests.forEach((cTest) { 227 coverageTests.forEach((cTest) {
226 String programDir = path.join(testingDirectory, cTest['name']); 228 String programDir = path.join(testingDirectory, cTest['name']);
227 String programPath = path.join(programDir, "${cTest['name']}.dart"); 229 String programPath = path.join(programDir, "${cTest['name']}.dart");
228 testCoverage(programDir, programPath, 230 testCoverage(programDir, programPath,
229 new LcovDescriptor(programPath), 231 new LcovDescriptor(programPath),
230 new List.from(cTest['expectedHits'])); 232 new List.from(cTest['expectedHits']));
231 testCoverage(programDir, programPath, 233 testCoverage(programDir, programPath,
232 new PrettyPrintDescriptor(programPath), 234 new PrettyPrintDescriptor(programPath),
233 new List.from(cTest['expectedHits'])); 235 new List.from(cTest['expectedHits']));
234 }); 236 });
235 }); 237 });
236 } 238 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698