| 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 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 5 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 6 import 'package:test/test.dart'; | 6 import 'package:test/test.dart'; |
| 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 7 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 8 | 8 |
| 9 import '../integration_tests.dart'; | 9 import '../integration_tests.dart'; |
| 10 | 10 |
| 11 main() { | 11 main() { |
| 12 defineReflectiveSuite(() { | 12 defineReflectiveSuite(() { |
| 13 defineReflectiveTests(AnalysisErrorIntegrationTest); | 13 defineReflectiveTests(AnalysisErrorIntegrationTest); |
| 14 }); | 14 }); |
| 15 } | 15 } |
| 16 | 16 |
| 17 class AbstractAnalysisErrorIntegrationTest | 17 @reflectiveTest |
| 18 class AnalysisErrorIntegrationTest |
| 18 extends AbstractAnalysisServerIntegrationTest { | 19 extends AbstractAnalysisServerIntegrationTest { |
| 19 test_detect_simple_error() { | 20 test_detect_simple_error() { |
| 20 String pathname = sourcePath('test.dart'); | 21 String pathname = sourcePath('test.dart'); |
| 21 writeFile( | 22 writeFile( |
| 22 pathname, | 23 pathname, |
| 23 ''' | 24 ''' |
| 24 main() { | 25 main() { |
| 25 print(null) // parse error: missing ';' | 26 print(null) // parse error: missing ';' |
| 26 }'''); | 27 }'''); |
| 27 standardAnalysisSetup(); | 28 standardAnalysisSetup(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 expect( | 61 expect( |
| 61 allErrorMessages, | 62 allErrorMessages, |
| 62 contains( | 63 contains( |
| 63 "The class 'C' can't be used as a mixin because it extends a class o
ther than Object.")); | 64 "The class 'C' can't be used as a mixin because it extends a class o
ther than Object.")); |
| 64 expect( | 65 expect( |
| 65 allErrorMessages, | 66 allErrorMessages, |
| 66 contains( | 67 contains( |
| 67 "The class 'C' can't be used as a mixin because it references 'super
'.")); | 68 "The class 'C' can't be used as a mixin because it references 'super
'.")); |
| 68 } | 69 } |
| 69 | 70 |
| 71 @failingTest |
| 70 test_super_mixins_enabled() async { | 72 test_super_mixins_enabled() async { |
| 73 // We see errors here with the new driver (#28870). |
| 74 // Expected: empty |
| 75 // Actual: [ |
| 76 // AnalysisError:{"severity":"ERROR","type":"COMPILE_TIME_ERROR","locatio
n":{"file":"/var/folders/00/0w95r000h01000cxqpysvccm003j4q/T/analysisServerfbuOQ
b/test.dart","offset":31,"length":1,"startLine":1,"startColumn":32},"message":"T
he class 'C' can't be used as a mixin because it extends a class other than Obje
ct.","correction":"","code":"mixin_inherits_from_not_object","hasFix":false}, |
| 77 // AnalysisError:{"severity":"ERROR","type":"COMPILE_TIME_ERROR","locatio
n":{"file":"/var/folders/00/0w95r000h01000cxqpysvccm003j4q/T/analysisServerfbuOQ
b/test.dart","offset":31,"length":1,"startLine":1,"startColumn":32},"message":"T
he class 'C' can't be used as a mixin because it references 'super'.","correctio
n":"","code":"mixin_references_super","hasFix":false} |
| 78 // ] |
| 79 |
| 71 String pathname = sourcePath('test.dart'); | 80 String pathname = sourcePath('test.dart'); |
| 72 writeFile( | 81 writeFile( |
| 73 pathname, | 82 pathname, |
| 74 ''' | 83 ''' |
| 75 class Test extends Object with C { | 84 class Test extends Object with C { |
| 76 void foo() {} | 85 void foo() {} |
| 77 } | 86 } |
| 78 abstract class B { | 87 abstract class B { |
| 79 void foo() {} | 88 void foo() {} |
| 80 } | 89 } |
| 81 abstract class C extends B { | 90 abstract class C extends B { |
| 82 void bar() { | 91 void bar() { |
| 83 super.foo(); | 92 super.foo(); |
| 84 } | 93 } |
| 85 } | 94 } |
| 86 '''); | 95 '''); |
| 87 // ignore: deprecated_member_use | 96 // ignore: deprecated_member_use |
| 88 await sendAnalysisUpdateOptions( | 97 await sendAnalysisUpdateOptions( |
| 89 new AnalysisOptions()..enableSuperMixins = true); | 98 new AnalysisOptions()..enableSuperMixins = true); |
| 90 standardAnalysisSetup(); | 99 standardAnalysisSetup(); |
| 91 await analysisFinished; | 100 await analysisFinished; |
| 92 expect(currentAnalysisErrors[pathname], isList); | 101 expect(currentAnalysisErrors[pathname], isList); |
| 93 List<AnalysisError> errors = currentAnalysisErrors[pathname]; | 102 List<AnalysisError> errors = currentAnalysisErrors[pathname]; |
| 94 expect(errors, isEmpty); | 103 expect(errors, isEmpty); |
| 95 } | 104 } |
| 96 } | 105 } |
| 97 | |
| 98 @reflectiveTest | |
| 99 class AnalysisErrorIntegrationTest | |
| 100 extends AbstractAnalysisErrorIntegrationTest {} | |
| OLD | NEW |