OLD | NEW |
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'; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 | 43 |
44 main() { | 44 main() { |
45 if (false) { | 45 if (false) { |
46 dummy(11); | 46 dummy(11); |
47 } else { | 47 } else { |
48 fac(10); | 48 fac(10); |
49 } | 49 } |
50 } | 50 } |
51 ''', | 51 ''', |
52 'expectedHits': [-1, 0, 0, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, -1, -1, | 52 'expectedHits': [-1, 0, 0, -1, -1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, |
53 0, -1, 1, -1, -1] | 53 0, -1, 1, -1, -1] |
54 },{ | 54 },{ |
55 'name': 'closures', | 55 'name': 'closures', |
56 'program': ''' | 56 'program': ''' |
57 main() { | 57 main() { |
58 foo(bar) { | 58 foo(bar) { |
59 bar(); | 59 bar(); |
60 } | 60 } |
61 | 61 |
62 foo(() { | 62 foo(() { |
63 print("in closure"); | 63 print("in closure"); |
64 }); | 64 }); |
65 } | 65 } |
66 ''', | 66 ''', |
67 'expectedHits': [-1, -1, 1, -1, -1, 1, 1, -1, -1] | 67 'expectedHits': [1, -1, 1, -1, -1, 1, 1, -1, -1] |
68 } | 68 } |
69 ]; | 69 ]; |
70 | 70 |
71 | 71 |
72 String prepareEnv() { | 72 String prepareEnv() { |
73 Directory testDir = Directory.systemTemp.createTempSync("coverage-"); | 73 Directory testDir = Directory.systemTemp.createTempSync("coverage-"); |
74 for (var coverageProg in coverageTests) { | 74 for (var coverageProg in coverageTests) { |
75 var coverageProgDir = new Directory( | 75 var coverageProgDir = new Directory( |
76 path.join(testDir.path, coverageProg["name"])) | 76 path.join(testDir.path, coverageProg["name"])) |
77 ..createSync(); | 77 ..createSync(); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 String programPath = path.join(programDir, "${cTest['name']}.dart"); | 223 String programPath = path.join(programDir, "${cTest['name']}.dart"); |
224 testCoverage(programDir, programPath, | 224 testCoverage(programDir, programPath, |
225 new LcovDescriptor(programPath), | 225 new LcovDescriptor(programPath), |
226 new List.from(cTest['expectedHits'])); | 226 new List.from(cTest['expectedHits'])); |
227 testCoverage(programDir, programPath, | 227 testCoverage(programDir, programPath, |
228 new PrettyPrintDescriptor(programPath), | 228 new PrettyPrintDescriptor(programPath), |
229 new List.from(cTest['expectedHits'])); | 229 new List.from(cTest['expectedHits'])); |
230 }); | 230 }); |
231 }); | 231 }); |
232 } | 232 } |
OLD | NEW |