| 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.notification_errors; | 5 library test.analysis.notification_errors; |
| 6 | 6 |
| 7 import 'package:analysis_server/src/constants.dart'; | 7 import 'package:analysis_server/src/constants.dart'; |
| 8 import 'package:analysis_server/src/domain_analysis.dart'; | 8 import 'package:analysis_server/src/domain_analysis.dart'; |
| 9 import 'package:analysis_server/src/protocol.dart'; | 9 import 'package:analysis_server/src/protocol.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 filesErrors[decoded.file] = decoded.errors; | 29 filesErrors[decoded.file] = decoded.errors; |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 @override | 33 @override |
| 34 void setUp() { | 34 void setUp() { |
| 35 super.setUp(); | 35 super.setUp(); |
| 36 server.handlers = [new AnalysisDomainHandler(server),]; | 36 server.handlers = [new AnalysisDomainHandler(server),]; |
| 37 } | 37 } |
| 38 | 38 |
| 39 test_notInAnalysisRoot() { |
| 40 createProject(); |
| 41 String otherFile = '/other.dart'; |
| 42 addFile(otherFile, 'UnknownType V;'); |
| 43 addTestFile(''' |
| 44 import '/other.dart'; |
| 45 |
| 46 main() { |
| 47 print(V); |
| 48 } |
| 49 '''); |
| 50 return waitForTasksFinished().then((_) { |
| 51 expect(filesErrors[otherFile], isNull); |
| 52 }); |
| 53 } |
| 54 |
| 39 test_ParserError() { | 55 test_ParserError() { |
| 40 createProject(); | 56 createProject(); |
| 41 addTestFile('library lib'); | 57 addTestFile('library lib'); |
| 42 return waitForTasksFinished().then((_) { | 58 return waitForTasksFinished().then((_) { |
| 43 List<AnalysisError> errors = filesErrors[testFile]; | 59 List<AnalysisError> errors = filesErrors[testFile]; |
| 44 expect(errors, hasLength(1)); | 60 expect(errors, hasLength(1)); |
| 45 AnalysisError error = errors[0]; | 61 AnalysisError error = errors[0]; |
| 46 expect(error.location.file, '/project/bin/test.dart'); | 62 expect(error.location.file, '/project/bin/test.dart'); |
| 47 expect(error.location.offset, isPositive); | 63 expect(error.location.offset, isPositive); |
| 48 expect(error.location.length, isNonNegative); | 64 expect(error.location.length, isNonNegative); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 60 } | 76 } |
| 61 '''); | 77 '''); |
| 62 return waitForTasksFinished().then((_) { | 78 return waitForTasksFinished().then((_) { |
| 63 List<AnalysisError> errors = filesErrors[testFile]; | 79 List<AnalysisError> errors = filesErrors[testFile]; |
| 64 expect(errors, hasLength(1)); | 80 expect(errors, hasLength(1)); |
| 65 AnalysisError error = errors[0]; | 81 AnalysisError error = errors[0]; |
| 66 expect(error.severity, AnalysisErrorSeverity.WARNING); | 82 expect(error.severity, AnalysisErrorSeverity.WARNING); |
| 67 expect(error.type, AnalysisErrorType.STATIC_WARNING); | 83 expect(error.type, AnalysisErrorType.STATIC_WARNING); |
| 68 }); | 84 }); |
| 69 } | 85 } |
| 70 | |
| 71 test_notInAnalysisRoot() { | |
| 72 createProject(); | |
| 73 String otherFile = '/other.dart'; | |
| 74 addFile(otherFile, 'UnknownType V;'); | |
| 75 addTestFile(''' | |
| 76 import '/other.dart'; | |
| 77 | |
| 78 main() { | |
| 79 print(V); | |
| 80 } | 86 } |
| 81 '''); | |
| 82 return waitForTasksFinished().then((_) { | |
| 83 expect(filesErrors[otherFile], isNull); | |
| 84 }); | |
| 85 } | |
| 86 } | |
| OLD | NEW |