| 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:analysis_testing/reflective_tests.dart'; | 10 import 'package:analysis_testing/reflective_tests.dart'; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 test_ParserError() { | 39 test_ParserError() { |
| 40 createProject(); | 40 createProject(); |
| 41 addTestFile('library lib'); | 41 addTestFile('library lib'); |
| 42 return waitForTasksFinished().then((_) { | 42 return waitForTasksFinished().then((_) { |
| 43 List<AnalysisError> errors = filesErrors[testFile]; | 43 List<AnalysisError> errors = filesErrors[testFile]; |
| 44 expect(errors, hasLength(1)); | 44 expect(errors, hasLength(1)); |
| 45 AnalysisError error = errors[0]; | 45 AnalysisError error = errors[0]; |
| 46 expect(error.location.file, '/project/bin/test.dart'); | 46 expect(error.location.file, '/project/bin/test.dart'); |
| 47 expect(error.location.offset, isPositive); | 47 expect(error.location.offset, isPositive); |
| 48 expect(error.location.length, isNonNegative); | 48 expect(error.location.length, isNonNegative); |
| 49 expect(error.severity, ErrorSeverity.ERROR); | 49 expect(error.severity, AnalysisErrorSeverity.ERROR); |
| 50 expect(error.type, ErrorType.SYNTACTIC_ERROR); | 50 expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR); |
| 51 expect(error.message, isNotNull); | 51 expect(error.message, isNotNull); |
| 52 }); | 52 }); |
| 53 } | 53 } |
| 54 | 54 |
| 55 test_StaticWarning() { | 55 test_StaticWarning() { |
| 56 createProject(); | 56 createProject(); |
| 57 addTestFile(''' | 57 addTestFile(''' |
| 58 main() { | 58 main() { |
| 59 print(UNKNOWN); | 59 print(UNKNOWN); |
| 60 } | 60 } |
| 61 '''); | 61 '''); |
| 62 return waitForTasksFinished().then((_) { | 62 return waitForTasksFinished().then((_) { |
| 63 List<AnalysisError> errors = filesErrors[testFile]; | 63 List<AnalysisError> errors = filesErrors[testFile]; |
| 64 expect(errors, hasLength(1)); | 64 expect(errors, hasLength(1)); |
| 65 AnalysisError error = errors[0]; | 65 AnalysisError error = errors[0]; |
| 66 expect(error.severity, ErrorSeverity.WARNING); | 66 expect(error.severity, AnalysisErrorSeverity.WARNING); |
| 67 expect(error.type, ErrorType.STATIC_WARNING); | 67 expect(error.type, AnalysisErrorType.STATIC_WARNING); |
| 68 }); | 68 }); |
| 69 } | 69 } |
| 70 | 70 |
| 71 test_notInAnalysisRoot() { | 71 test_notInAnalysisRoot() { |
| 72 createProject(); | 72 createProject(); |
| 73 String otherFile = '/other.dart'; | 73 String otherFile = '/other.dart'; |
| 74 addFile(otherFile, 'UnknownType V;'); | 74 addFile(otherFile, 'UnknownType V;'); |
| 75 addTestFile(''' | 75 addTestFile(''' |
| 76 import '/other.dart'; | 76 import '/other.dart'; |
| 77 | 77 |
| 78 main() { | 78 main() { |
| 79 print(V); | 79 print(V); |
| 80 } | 80 } |
| 81 '''); | 81 '''); |
| 82 return waitForTasksFinished().then((_) { | 82 return waitForTasksFinished().then((_) { |
| 83 expect(filesErrors[otherFile], isNull); | 83 expect(filesErrors[otherFile], isNull); |
| 84 }); | 84 }); |
| 85 } | 85 } |
| 86 } | 86 } |
| OLD | NEW |