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