| OLD | NEW |
| 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:analysis_server/src/services/correction/strings.dart'; | 7 import 'package:analysis_server/src/services/correction/strings.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 23 matching lines...) Expand all Loading... |
| 34 new File(path.join(pathPrefix, 'test', 'integration', 'coverage.md')); | 34 new File(path.join(pathPrefix, 'test', 'integration', 'coverage.md')); |
| 35 List<String> lines = coverageFile.readAsLinesSync(); | 35 List<String> lines = coverageFile.readAsLinesSync(); |
| 36 | 36 |
| 37 // ## server domain | 37 // ## server domain |
| 38 Set<String> coveredDomains = lines | 38 Set<String> coveredDomains = lines |
| 39 .where((line) => line.startsWith('## ') && line.endsWith(' domain')) | 39 .where((line) => line.startsWith('## ') && line.endsWith(' domain')) |
| 40 .map((line) => | 40 .map((line) => |
| 41 line.substring('##'.length, line.length - 'domain'.length).trim()) | 41 line.substring('##'.length, line.length - 'domain'.length).trim()) |
| 42 .toSet(); | 42 .toSet(); |
| 43 | 43 |
| 44 // Remove any ' (test failed)' suffixes. |
| 45 lines = lines.map((String line) { |
| 46 int index = line.indexOf('('); |
| 47 return index != -1 ? line.substring(0, index).trim() : line; |
| 48 }).toList(); |
| 49 |
| 44 // - [ ] server.getVersion | 50 // - [ ] server.getVersion |
| 45 Set<String> allMembers = lines | 51 Set<String> allMembers = lines |
| 46 .where((line) => line.startsWith('- ')) | 52 .where((line) => line.startsWith('- ')) |
| 47 .map((line) => line.substring('- [ ]'.length).trim()) | 53 .map((line) => line.substring('- [ ]'.length).trim()) |
| 48 .toSet(); | 54 .toSet(); |
| 49 Set<String> coveredMembers = lines | 55 Set<String> coveredMembers = lines |
| 50 .where((line) => line.startsWith('- [x]')) | 56 .where((line) => line.startsWith('- [x]')) |
| 51 .map((line) => line.substring('- [x]'.length).trim()) | 57 .map((line) => line.substring('- [x]'.length).trim()) |
| 52 .toSet(); | 58 .toSet(); |
| 53 | 59 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 95 |
| 90 // validate no unexpected domains | 96 // validate no unexpected domains |
| 91 group('integration coverage', () { | 97 group('integration coverage', () { |
| 92 test('no unexpected domains', () { | 98 test('no unexpected domains', () { |
| 93 for (String domain in coveredDomains) { | 99 for (String domain in coveredDomains) { |
| 94 expect(api.domains.map((d) => d.name), contains(domain)); | 100 expect(api.domains.map((d) => d.name), contains(domain)); |
| 95 } | 101 } |
| 96 }); | 102 }); |
| 97 }); | 103 }); |
| 98 } | 104 } |
| OLD | NEW |