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.analysis.get_errors; | 5 library test.analysis.get_errors; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/domain_analysis.dart'; | 9 import 'package:analysis_server/src/domain_analysis.dart'; |
10 import 'package:analysis_server/src/protocol.dart'; | 10 import 'package:analysis_server/src/protocol.dart'; |
11 import 'package:analyzer/file_system/file_system.dart'; | 11 import 'package:analyzer/file_system/file_system.dart'; |
12 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 12 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
13 import 'package:unittest/unittest.dart'; | 13 import 'package:unittest/unittest.dart'; |
14 | 14 |
15 import '../analysis_abstract.dart'; | 15 import '../analysis_abstract.dart'; |
| 16 import '../utils.dart'; |
16 | 17 |
17 main() { | 18 main() { |
18 groupSep = ' | '; | 19 initializeTestEnvironment(); |
19 defineReflectiveTests(GetErrorsTest); | 20 defineReflectiveTests(GetErrorsTest); |
20 } | 21 } |
21 | 22 |
22 @reflectiveTest | 23 @reflectiveTest |
23 class GetErrorsTest extends AbstractAnalysisTest { | 24 class GetErrorsTest extends AbstractAnalysisTest { |
24 static const String requestId = 'test-getError'; | 25 static const String requestId = 'test-getError'; |
25 | 26 |
26 @override | 27 @override |
27 void setUp() { | 28 void setUp() { |
28 super.setUp(); | 29 super.setUp(); |
(...skipping 14 matching lines...) Expand all Loading... |
43 }); | 44 }); |
44 } | 45 } |
45 | 46 |
46 test_fileDoesNotExist() { | 47 test_fileDoesNotExist() { |
47 String file = '$projectPath/doesNotExist.dart'; | 48 String file = '$projectPath/doesNotExist.dart'; |
48 return _checkInvalid(file); | 49 return _checkInvalid(file); |
49 } | 50 } |
50 | 51 |
51 test_fileWithoutContext() { | 52 test_fileWithoutContext() { |
52 String file = '/outside.dart'; | 53 String file = '/outside.dart'; |
53 addFile(file, ''' | 54 addFile( |
| 55 file, |
| 56 ''' |
54 main() { | 57 main() { |
55 print(42); | 58 print(42); |
56 } | 59 } |
57 '''); | 60 '''); |
58 return _checkInvalid(file); | 61 return _checkInvalid(file); |
59 } | 62 } |
60 | 63 |
61 test_hasErrors() { | 64 test_hasErrors() { |
62 addTestFile(''' | 65 addTestFile(''' |
63 main() { | 66 main() { |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 return new AnalysisGetErrorsParams(testFile).toRequest(requestId); | 123 return new AnalysisGetErrorsParams(testFile).toRequest(requestId); |
121 } | 124 } |
122 | 125 |
123 Future<List<AnalysisError>> _getErrors(String file) { | 126 Future<List<AnalysisError>> _getErrors(String file) { |
124 Request request = _createGetErrorsRequest(); | 127 Request request = _createGetErrorsRequest(); |
125 return serverChannel.sendRequest(request).then((Response response) { | 128 return serverChannel.sendRequest(request).then((Response response) { |
126 return new AnalysisGetErrorsResult.fromResponse(response).errors; | 129 return new AnalysisGetErrorsResult.fromResponse(response).errors; |
127 }); | 130 }); |
128 } | 131 } |
129 } | 132 } |
OLD | NEW |