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

Side by Side Diff: pkg/analysis_server/test/integration/coverage_test.dart

Issue 3000563002: Add analysis server notifications to the api coverage doc. (Closed)
Patch Set: Created 3 years, 4 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 | « pkg/analysis_server/test/integration/coverage.md ('k') | no next file » | 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) 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:io'; 5 import 'dart:io';
6 6
7 import 'package:analyzer_plugin/src/utilities/string_utilities.dart'; 7 import 'package:analyzer_plugin/src/utilities/string_utilities.dart';
8 import 'package:path/path.dart' as path; 8 import 'package:path/path.dart' as path;
9 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 for (Domain domain in api.domains) { 58 for (Domain domain in api.domains) {
59 group('integration coverage of ${domain.name}', () { 59 group('integration coverage of ${domain.name}', () {
60 // domain 60 // domain
61 test('domain', () { 61 test('domain', () {
62 if (!coveredDomains.contains(domain.name)) { 62 if (!coveredDomains.contains(domain.name)) {
63 fail('${domain.name} domain not found in ${coverageFile.path}'); 63 fail('${domain.name} domain not found in ${coverageFile.path}');
64 } 64 }
65 }); 65 });
66 66
67 // requests 67 // requests
68 for (Request request in domain.requests) { 68 group('request', () {
69 String fullName = '${domain.name}.${request.method}'; 69 for (Request request in domain.requests) {
70 test(fullName, () { 70 String fullName = '${domain.name}.${request.method}';
71 if (!allMembers.contains(fullName)) { 71 test(fullName, () {
72 fail('$fullName not found in ${coverageFile.path}'); 72 if (!allMembers.contains(fullName)) {
73 } 73 fail('$fullName not found in ${coverageFile.path}');
74 }
74 75
75 final String fileName = getCamelWords(request.method) 76 final String fileName = getCamelWords(request.method)
76 .map((s) => s.toLowerCase()) 77 .map((s) => s.toLowerCase())
77 .join('_'); 78 .join('_');
78 final String testName = 79 final String testName =
79 path.join(domain.name, '${fileName}_test.dart'); 80 path.join(domain.name, '${fileName}_test.dart');
80 final String testPath = 81 final String testPath =
81 path.join(pathPrefix, 'test', 'integration', testName); 82 path.join(pathPrefix, 'test', 'integration', testName);
82 83
83 // Test that if checked, a test file exists; if not checked, no such 84 // Test that if checked, a test file exists; if not checked, no such
84 // file exists. 85 // file exists.
85 expect(FileSystemEntity.isFileSync(testPath), 86 expect(FileSystemEntity.isFileSync(testPath),
86 coveredMembers.contains(fullName), 87 coveredMembers.contains(fullName),
87 reason: '$testName state incorrect'); 88 reason: '$testName state incorrect');
88 }); 89 });
89 } 90 }
91 });
92
93 // notifications
94 group('notification', () {
95 for (Notification notification in domain.notifications) {
96 String fullName = '${domain.name}.${notification.event}';
97 test(fullName, () {
98 if (!allMembers.contains(fullName)) {
99 fail('$fullName not found in ${coverageFile.path}');
100 }
101
102 final String fileName = getCamelWords(notification.event)
103 .map((s) => s.toLowerCase())
104 .join('_');
105 final String testName =
106 path.join(domain.name, '${fileName}_test.dart');
107 final String testPath =
108 path.join(pathPrefix, 'test', 'integration', testName);
109
110 // Test that if checked, a test file exists; if not checked, no such
111 // file exists.
112 expect(FileSystemEntity.isFileSync(testPath),
113 coveredMembers.contains(fullName),
114 reason: '$testName state incorrect');
115 });
116 }
117 });
90 }); 118 });
91 } 119 }
92 120
93 // validate no unexpected domains 121 // validate no unexpected domains
94 group('integration coverage', () { 122 group('integration coverage', () {
95 test('no unexpected domains', () { 123 test('no unexpected domains', () {
96 for (String domain in coveredDomains) { 124 for (String domain in coveredDomains) {
97 expect(api.domains.map((d) => d.name), contains(domain)); 125 expect(api.domains.map((d) => d.name), contains(domain));
98 } 126 }
99 }); 127 });
100 }); 128 });
101 } 129 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/integration/coverage.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698