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

Side by Side Diff: runtime/observatory/tests/service/coverage_test.dart

Issue 1330703002: Do not emit coverage/callsite info for implicit closure functions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: fix test 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
« no previous file with comments | « no previous file | runtime/vm/coverage.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // VMOptions=--error_on_bad_type --error_on_bad_override 4 // VMOptions=--error_on_bad_type --error_on_bad_override
5 5
6 import 'package:observatory/service_io.dart'; 6 import 'package:observatory/service_io.dart';
7 import 'package:unittest/unittest.dart'; 7 import 'package:unittest/unittest.dart';
8 import 'test_helper.dart'; 8 import 'test_helper.dart';
9 import 'dart:developer'; 9 import 'dart:developer';
10 10
11 int globalVar = 100; 11 int globalVar = 100;
12 12
13 class MyClass { 13 class MyClass {
14 static void myFunction(int value) { 14 static void myFunction(int value) {
15 if (value < 0) { 15 if (value < 0) {
16 print("negative"); 16 print("negative");
17 } else { 17 } else {
18 print("positive"); 18 print("positive");
19 } 19 }
20 debugger(); 20 debugger();
21 } 21 }
22 22
23 static void otherFunction(int value) { 23 static void otherFunction(int value) {
24 if (value < 0) { 24 if (value < 0) {
25 print("otherFunction <"); 25 print("otherFunction <");
26 } else { 26 } else {
27 print("otherFunction >="); 27 print("otherFunction >=");
28 } 28 }
29 } 29 }
30 } 30 }
31 31
32 void testFunction() { 32 void testFunction() {
33 MyClass.otherFunction(-100); 33 MyClass.otherFunction(-100);
34 MyClass.myFunction(10000); 34 MyClass.myFunction(10000);
35 } 35 }
36 36
37 var tests = [ 37 var tests = [
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 24, 1, 25, 1, 27, 0])); 72 24, 1, 25, 1, 27, 0]));
73 73
74 // Library 74 // Library
75 coverage = await isolate.invokeRpcNoUpgrade('_getCoverage', 75 coverage = await isolate.invokeRpcNoUpgrade('_getCoverage',
76 { 'targetId': lib.id }); 76 { 'targetId': lib.id });
77 expect(coverage['type'], equals('CodeCoverage')); 77 expect(coverage['type'], equals('CodeCoverage'));
78 expect(coverage['coverage'].length, equals(3)); 78 expect(coverage['coverage'].length, equals(3));
79 expect(coverage['coverage'][0]['hits'], 79 expect(coverage['coverage'][0]['hits'],
80 equals([15, 1, 16, 0, 18, 1, 20, 1, 80 equals([15, 1, 16, 0, 18, 1, 20, 1,
81 24, 1, 25, 1, 27, 0])); 81 24, 1, 25, 1, 27, 0]));
82 expect(coverage['coverage'][1]['hits'].take(12), 82 expect(coverage['coverage'][1]['hits'],
83 equals([33, 1, 34, 1, 32, 1, 105, 2, 105, 1])); 83 equals([33, 1, 34, 1, 105, 2]));
84 84
85 // Script 85 // Script
86 await cls.load(); 86 await cls.load();
87 coverage = await isolate.invokeRpcNoUpgrade('_getCoverage', 87 coverage = await isolate.invokeRpcNoUpgrade('_getCoverage',
88 { 'targetId': cls.location.script.id }); 88 { 'targetId': cls.location.script.id });
89 expect(coverage['type'], equals('CodeCoverage')); 89 expect(coverage['type'], equals('CodeCoverage'));
90 expect(coverage['coverage'].length, equals(3)); 90 expect(coverage['coverage'].length, equals(3));
91 expect(coverage['coverage'][0]['hits'], 91 expect(coverage['coverage'][0]['hits'],
92 equals([15, 1, 16, 0, 18, 1, 20, 1, 92 equals([15, 1, 16, 0, 18, 1, 20, 1,
93 24, 1, 25, 1, 27, 0])); 93 24, 1, 25, 1, 27, 0]));
94 expect(coverage['coverage'][1]['hits'].take(12), 94 expect(coverage['coverage'][1]['hits'],
95 equals([33, 1, 34, 1, 32, 1, 105, 2, 105, 1])); 95 equals([33, 1, 34, 1, 105, 2]));
96 96
97 // Isolate 97 // Isolate
98 coverage = await isolate.invokeRpcNoUpgrade('_getCoverage', {}); 98 coverage = await isolate.invokeRpcNoUpgrade('_getCoverage', {});
99 expect(coverage['type'], equals('CodeCoverage')); 99 expect(coverage['type'], equals('CodeCoverage'));
100 expect(coverage['coverage'].length, greaterThan(100)); 100 expect(coverage['coverage'].length, greaterThan(100));
101 }, 101 },
102 102
103 ]; 103 ];
104 104
105 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); 105 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction);
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/coverage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698