| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 | 8 |
| 9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
| 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 10 | 11 |
| 11 import '../integration_tests.dart'; | 12 import '../integration_tests.dart'; |
| 12 | 13 |
| 14 main() { |
| 15 defineReflectiveSuite(() { |
| 16 defineReflectiveTests(GetErrorsTest); |
| 17 defineReflectiveTests(GetErrorsTest_Driver); |
| 18 }); |
| 19 } |
| 20 |
| 13 /** | 21 /** |
| 14 * Base class for testing the "analysis.getErrors" request. | 22 * Base class for testing the "analysis.getErrors" request. |
| 15 */ | 23 */ |
| 16 class AnalysisDomainGetErrorsTest | 24 class AnalysisDomainGetErrorsTest |
| 17 extends AbstractAnalysisServerIntegrationTest { | 25 extends AbstractAnalysisServerIntegrationTest { |
| 18 /** | 26 AnalysisDomainGetErrorsTest(); |
| 19 * True if the "analysis.getErrors" request should be made after analysis is | |
| 20 * complete. | |
| 21 */ | |
| 22 final bool afterAnalysis; | |
| 23 | |
| 24 AnalysisDomainGetErrorsTest(this.afterAnalysis); | |
| 25 | 27 |
| 26 test_getErrors() { | 28 test_getErrors() { |
| 27 String pathname = sourcePath('test.dart'); | 29 String pathname = sourcePath('test.dart'); |
| 28 String text = r''' | 30 String text = r''' |
| 29 main() { | 31 main() { |
| 30 var x // parse error: missing ';' | 32 var x // parse error: missing ';' |
| 31 }'''; | 33 }'''; |
| 32 writeFile(pathname, text); | 34 writeFile(pathname, text); |
| 33 standardAnalysisSetup(); | 35 standardAnalysisSetup(); |
| 34 Future finishTest() { | 36 Future finishTest() { |
| 35 return sendAnalysisGetErrors(pathname).then((result) { | 37 return sendAnalysisGetErrors(pathname).then((result) { |
| 36 expect(result.errors, equals(currentAnalysisErrors[pathname])); | 38 expect(result.errors, equals(currentAnalysisErrors[pathname])); |
| 37 }); | 39 }); |
| 38 } | 40 } |
| 39 if (afterAnalysis) { | 41 |
| 40 return analysisFinished.then((_) => finishTest()); | 42 return analysisFinished.then((_) => finishTest()); |
| 41 } else { | |
| 42 return finishTest(); | |
| 43 } | |
| 44 } | 43 } |
| 45 } | 44 } |
| 45 |
| 46 @reflectiveTest |
| 47 class GetErrorsTest extends AnalysisDomainGetErrorsTest {} |
| 48 |
| 49 @reflectiveTest |
| 50 class GetErrorsTest_Driver extends AnalysisDomainGetErrorsTest { |
| 51 @override |
| 52 bool get enableNewAnalysisDriver => true; |
| 53 } |
| OLD | NEW |