OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library test.integration.analysis.get.errors; | 5 library test.integration.analysis.get.errors; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 | 9 |
10 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
11 import 'package:analyzer/file_system/physical_file_system.dart'; | |
12 import 'package:analyzer/src/dart/sdk/sdk.dart'; | |
13 import 'package:analyzer/src/generated/sdk.dart'; | 11 import 'package:analyzer/src/generated/sdk.dart'; |
14 import 'package:path/path.dart' as path; | 12 import 'package:path/path.dart' as path; |
15 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 13 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
16 import 'package:unittest/unittest.dart'; | 14 import 'package:unittest/unittest.dart'; |
17 | 15 |
18 import '../../mock_sdk.dart'; | 16 import '../../mock_sdk.dart'; |
19 import '../../utils.dart'; | 17 import '../../utils.dart'; |
20 import '../integration_tests.dart'; | 18 import '../integration_tests.dart'; |
21 | 19 |
22 main() { | 20 main() { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 'lib', | 66 'lib', |
69 'libraries.dart' | 67 'libraries.dart' |
70 ]); | 68 ]); |
71 new Directory(path.dirname(librariesPath)).createSync(recursive: true); | 69 new Directory(path.dirname(librariesPath)).createSync(recursive: true); |
72 new File(librariesPath).writeAsStringSync(librariesContent.toString()); | 70 new File(librariesPath).writeAsStringSync(librariesContent.toString()); |
73 | 71 |
74 return sdkPath; | 72 return sdkPath; |
75 } | 73 } |
76 | 74 |
77 @override | 75 @override |
78 Future startServer({int servicesPort, bool checked: true}) { | 76 Future startServer( |
| 77 {bool checked: true, int diagnosticPort, int servicesPort}) { |
79 String sdkPath = createNonStandardSdk(); | 78 String sdkPath = createNonStandardSdk(); |
80 return server.start( | 79 return server.start( |
81 servicesPort: servicesPort, checked: checked, sdkPath: sdkPath); | 80 checked: checked, |
| 81 diagnosticPort: diagnosticPort, |
| 82 sdkPath: sdkPath, |
| 83 servicesPort: servicesPort); |
82 } | 84 } |
83 | 85 |
84 Future test_getErrors() async { | 86 Future test_getErrors() async { |
85 String pathname = sourcePath('test.dart'); | 87 String pathname = sourcePath('test.dart'); |
86 String text = r''' | 88 String text = r''' |
87 import 'dart:core'; | 89 import 'dart:core'; |
88 import 'dart:fake'; | 90 import 'dart:fake'; |
89 '''; | 91 '''; |
90 writeFile(pathname, text); | 92 writeFile(pathname, text); |
91 standardAnalysisSetup(); | 93 standardAnalysisSetup(); |
92 await analysisFinished; | 94 await analysisFinished; |
93 List<AnalysisError> errors = currentAnalysisErrors[pathname]; | 95 List<AnalysisError> errors = currentAnalysisErrors[pathname]; |
94 expect(errors, hasLength(1)); | 96 expect(errors, hasLength(1)); |
95 expect(errors[0].code, 'unused_import'); | 97 expect(errors[0].code, 'unused_import'); |
96 } | 98 } |
97 } | 99 } |
OLD | NEW |