| 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'; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 'lib', | 68 'lib', |
| 69 'libraries.dart' | 69 'libraries.dart' |
| 70 ]); | 70 ]); |
| 71 new Directory(path.dirname(librariesPath)).createSync(recursive: true); | 71 new Directory(path.dirname(librariesPath)).createSync(recursive: true); |
| 72 new File(librariesPath).writeAsStringSync(librariesContent.toString()); | 72 new File(librariesPath).writeAsStringSync(librariesContent.toString()); |
| 73 | 73 |
| 74 return sdkPath; | 74 return sdkPath; |
| 75 } | 75 } |
| 76 | 76 |
| 77 @override | 77 @override |
| 78 Future startServer({int servicesPort, bool checked: true}) { | 78 Future startServer( |
| 79 {bool checked: true, int diagnosticPort, int servicesPort}) { |
| 79 String sdkPath = createNonStandardSdk(); | 80 String sdkPath = createNonStandardSdk(); |
| 80 return server.start( | 81 return server.start( |
| 81 servicesPort: servicesPort, checked: checked, sdkPath: sdkPath); | 82 checked: checked, |
| 83 diagnosticPort: diagnosticPort, |
| 84 sdkPath: sdkPath, |
| 85 servicesPort: servicesPort); |
| 82 } | 86 } |
| 83 | 87 |
| 84 Future test_getErrors() async { | 88 Future test_getErrors() async { |
| 85 String pathname = sourcePath('test.dart'); | 89 String pathname = sourcePath('test.dart'); |
| 86 String text = r''' | 90 String text = r''' |
| 87 import 'dart:core'; | 91 import 'dart:core'; |
| 88 import 'dart:fake'; | 92 import 'dart:fake'; |
| 89 '''; | 93 '''; |
| 90 writeFile(pathname, text); | 94 writeFile(pathname, text); |
| 91 standardAnalysisSetup(); | 95 standardAnalysisSetup(); |
| 92 await analysisFinished; | 96 await analysisFinished; |
| 93 List<AnalysisError> errors = currentAnalysisErrors[pathname]; | 97 List<AnalysisError> errors = currentAnalysisErrors[pathname]; |
| 94 expect(errors, hasLength(1)); | 98 expect(errors, hasLength(1)); |
| 95 expect(errors[0].code, 'unused_import'); | 99 expect(errors[0].code, 'unused_import'); |
| 96 } | 100 } |
| 97 } | 101 } |
| OLD | NEW |