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.error; | 5 library test.integration.analysis.error; |
6 | 6 |
7 import 'package:analysis_server/src/protocol.dart'; | 7 import 'package:analysis_server/src/protocol.dart'; |
8 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 8 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
9 import 'package:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 print(null) // parse error: missing ';' | 28 print(null) // parse error: missing ';' |
29 }'''); | 29 }'''); |
30 standardAnalysisSetup(); | 30 standardAnalysisSetup(); |
31 return analysisFinished.then((_) { | 31 return analysisFinished.then((_) { |
32 expect(currentAnalysisErrors[pathname], isList); | 32 expect(currentAnalysisErrors[pathname], isList); |
33 List<AnalysisError> errors = currentAnalysisErrors[pathname]; | 33 List<AnalysisError> errors = currentAnalysisErrors[pathname]; |
34 expect(errors, hasLength(1)); | 34 expect(errors, hasLength(1)); |
35 expect(errors[0].location.file, equals(pathname)); | 35 expect(errors[0].location.file, equals(pathname)); |
36 }); | 36 }); |
37 } | 37 } |
| 38 |
| 39 test_super_mixins_disabled() async { |
| 40 String pathname = sourcePath('test.dart'); |
| 41 writeFile( |
| 42 pathname, |
| 43 ''' |
| 44 class Test extends Object with C { |
| 45 void foo() {} |
38 } | 46 } |
| 47 abstract class B { |
| 48 void foo(); |
| 49 } |
| 50 abstract class C extends B { |
| 51 void bar() { |
| 52 super.foo(); |
| 53 } |
| 54 } |
| 55 '''); |
| 56 standardAnalysisSetup(); |
| 57 await analysisFinished; |
| 58 expect(currentAnalysisErrors[pathname], isList); |
| 59 List<AnalysisError> errors = currentAnalysisErrors[pathname]; |
| 60 expect(errors, hasLength(2)); |
| 61 Set<String> allErrorMessages = |
| 62 errors.map((AnalysisError e) => e.message).toSet(); |
| 63 expect( |
| 64 allErrorMessages, |
| 65 contains( |
| 66 "The class 'C' cannot be used as a mixin because it extends a class
other than Object")); |
| 67 expect( |
| 68 allErrorMessages, |
| 69 contains( |
| 70 "The class 'C' cannot be used as a mixin because it references 'supe
r'")); |
| 71 } |
| 72 |
| 73 test_super_mixins_enabled() async { |
| 74 String pathname = sourcePath('test.dart'); |
| 75 writeFile( |
| 76 pathname, |
| 77 ''' |
| 78 class Test extends Object with C { |
| 79 void foo() {} |
| 80 } |
| 81 abstract class B { |
| 82 void foo(); |
| 83 } |
| 84 abstract class C extends B { |
| 85 void bar() { |
| 86 super.foo(); |
| 87 } |
| 88 } |
| 89 '''); |
| 90 await sendAnalysisUpdateOptions( |
| 91 new AnalysisOptions()..enableSuperMixins = true); |
| 92 standardAnalysisSetup(); |
| 93 await analysisFinished; |
| 94 expect(currentAnalysisErrors[pathname], isList); |
| 95 List<AnalysisError> errors = currentAnalysisErrors[pathname]; |
| 96 expect(errors, isEmpty); |
| 97 } |
| 98 } |
OLD | NEW |