| 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; | |
| 6 | |
| 7 import 'dart:async'; | 5 import 'dart:async'; |
| 8 import 'dart:io'; | 6 import 'dart:io'; |
| 9 | 7 |
| 10 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 8 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 11 import 'package:analyzer/src/generated/sdk.dart'; | 9 import 'package:analyzer/src/generated/sdk.dart'; |
| 12 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
| 13 import 'package:test/test.dart'; | 11 import 'package:test/test.dart'; |
| 14 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 12 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 15 | 13 |
| 16 import '../../mock_sdk.dart'; | 14 import '../../mock_sdk.dart'; |
| 17 import '../integration_tests.dart'; | 15 import '../integration_tests.dart'; |
| 18 | 16 |
| 19 main() { | 17 main() { |
| 20 defineReflectiveSuite(() { | 18 defineReflectiveSuite(() { |
| 21 defineReflectiveTests(AnalysisDomainGetErrorsTest); | 19 defineReflectiveTests(AnalysisDomainGetErrorsTest); |
| 20 defineReflectiveTests(AnalysisDomainGetErrorsTest_Driver); |
| 22 }); | 21 }); |
| 23 } | 22 } |
| 24 | 23 |
| 25 /** | 24 /** |
| 26 * Tests that when an SDK path is specified on the command-line (via the `--sdk` | 25 * Tests that when an SDK path is specified on the command-line (via the `--sdk` |
| 27 * argument) that the specified SDK is used. | 26 * argument) that the specified SDK is used. |
| 28 */ | 27 */ |
| 29 @reflectiveTest | 28 class AbstractAnalysisDomainGetErrorsTest |
| 30 class AnalysisDomainGetErrorsTest | |
| 31 extends AbstractAnalysisServerIntegrationTest { | 29 extends AbstractAnalysisServerIntegrationTest { |
| 32 AnalysisDomainGetErrorsTest(); | |
| 33 | |
| 34 String createNonStandardSdk() { | 30 String createNonStandardSdk() { |
| 35 MockSdkLibrary fakeLibrary = | 31 MockSdkLibrary fakeLibrary = |
| 36 new MockSdkLibrary('dart:fake', '/lib/fake/fake.dart', ''); | 32 new MockSdkLibrary('dart:fake', '/lib/fake/fake.dart', ''); |
| 37 String sdkPath = path.join(sourceDirectory.path, 'sdk'); | 33 String sdkPath = path.join(sourceDirectory.path, 'sdk'); |
| 38 StringBuffer librariesContent = new StringBuffer(); | 34 StringBuffer librariesContent = new StringBuffer(); |
| 39 librariesContent.writeln( | 35 librariesContent.writeln( |
| 40 'final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo>
{'); | 36 'final Map<String, LibraryInfo> LIBRARIES = const <String, LibraryInfo>
{'); |
| 41 MockSdk.LIBRARIES.toList() | 37 MockSdk.LIBRARIES.toList() |
| 42 ..add(fakeLibrary) | 38 ..add(fakeLibrary) |
| 43 ..forEach((SdkLibrary library) { | 39 ..forEach((SdkLibrary library) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 import 'dart:fake'; | 86 import 'dart:fake'; |
| 91 '''; | 87 '''; |
| 92 writeFile(pathname, text); | 88 writeFile(pathname, text); |
| 93 standardAnalysisSetup(); | 89 standardAnalysisSetup(); |
| 94 await analysisFinished; | 90 await analysisFinished; |
| 95 List<AnalysisError> errors = currentAnalysisErrors[pathname]; | 91 List<AnalysisError> errors = currentAnalysisErrors[pathname]; |
| 96 expect(errors, hasLength(1)); | 92 expect(errors, hasLength(1)); |
| 97 expect(errors[0].code, 'unused_import'); | 93 expect(errors[0].code, 'unused_import'); |
| 98 } | 94 } |
| 99 } | 95 } |
| 96 |
| 97 @reflectiveTest |
| 98 class AnalysisDomainGetErrorsTest extends AbstractAnalysisDomainGetErrorsTest {} |
| 99 |
| 100 @reflectiveTest |
| 101 class AnalysisDomainGetErrorsTest_Driver |
| 102 extends AbstractAnalysisDomainGetErrorsTest { |
| 103 @override |
| 104 bool get enableNewAnalysisDriver => true; |
| 105 } |
| OLD | NEW |