Chromium Code Reviews| 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 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
| 8 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
| 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 9 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 10 | 10 |
| 11 import '../integration_tests.dart'; | 11 import '../integration_tests.dart'; |
| 12 | 12 |
| 13 main() { | 13 main() { |
| 14 defineReflectiveSuite(() { | 14 defineReflectiveSuite(() { |
| 15 defineReflectiveTests(AnalysisErrorIntegrationTest); | 15 defineReflectiveTests(AnalysisErrorIntegrationTest); |
| 16 defineReflectiveTests(NoAnalysisErrorsIntegrationTest); | 16 defineReflectiveTests(NoAnalysisErrorsIntegrationTest); |
| 17 defineReflectiveTests(NoAnalysisErrorsIntegrationTest_Driver); | |
| 18 }); | 17 }); |
| 19 } | 18 } |
| 20 | 19 |
| 21 class AbstractAnalysisErrorIntegrationTest | 20 @reflectiveTest |
| 21 class AnalysisErrorIntegrationTest | |
| 22 extends AbstractAnalysisServerIntegrationTest { | 22 extends AbstractAnalysisServerIntegrationTest { |
| 23 test_detect_simple_error() { | 23 test_detect_simple_error() { |
| 24 String pathname = sourcePath('test.dart'); | 24 String pathname = sourcePath('test.dart'); |
| 25 writeFile( | 25 writeFile( |
| 26 pathname, | 26 pathname, |
| 27 ''' | 27 ''' |
| 28 main() { | 28 main() { |
| 29 print(null) // parse error: missing ';' | 29 print(null) // parse error: missing ';' |
| 30 }'''); | 30 }'''); |
| 31 standardAnalysisSetup(); | 31 standardAnalysisSetup(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 64 expect( | 64 expect( |
| 65 allErrorMessages, | 65 allErrorMessages, |
| 66 contains( | 66 contains( |
| 67 "The class 'C' can't be used as a mixin because it extends a class o ther than Object.")); | 67 "The class 'C' can't be used as a mixin because it extends a class o ther than Object.")); |
| 68 expect( | 68 expect( |
| 69 allErrorMessages, | 69 allErrorMessages, |
| 70 contains( | 70 contains( |
| 71 "The class 'C' can't be used as a mixin because it references 'super '.")); | 71 "The class 'C' can't be used as a mixin because it references 'super '.")); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // We see errors here with the new driver (#28870). | |
|
Brian Wilkerson
2017/02/23 17:58:18
Move comments like this inside the method (or at l
| |
| 75 @failingTest | |
| 74 test_super_mixins_enabled() async { | 76 test_super_mixins_enabled() async { |
| 75 String pathname = sourcePath('test.dart'); | 77 String pathname = sourcePath('test.dart'); |
| 76 writeFile( | 78 writeFile( |
| 77 pathname, | 79 pathname, |
| 78 ''' | 80 ''' |
| 79 class Test extends Object with C { | 81 class Test extends Object with C { |
| 80 void foo() {} | 82 void foo() {} |
| 81 } | 83 } |
| 82 abstract class B { | 84 abstract class B { |
| 83 void foo() {} | 85 void foo() {} |
| 84 } | 86 } |
| 85 abstract class C extends B { | 87 abstract class C extends B { |
| 86 void bar() { | 88 void bar() { |
| 87 super.foo(); | 89 super.foo(); |
| 88 } | 90 } |
| 89 } | 91 } |
| 90 '''); | 92 '''); |
| 91 await sendAnalysisUpdateOptions( | 93 await sendAnalysisUpdateOptions( |
| 92 new AnalysisOptions()..enableSuperMixins = true); | 94 new AnalysisOptions()..enableSuperMixins = true); |
| 93 standardAnalysisSetup(); | 95 standardAnalysisSetup(); |
| 94 await analysisFinished; | 96 await analysisFinished; |
| 95 expect(currentAnalysisErrors[pathname], isList); | 97 expect(currentAnalysisErrors[pathname], isList); |
| 96 List<AnalysisError> errors = currentAnalysisErrors[pathname]; | 98 List<AnalysisError> errors = currentAnalysisErrors[pathname]; |
| 97 expect(errors, isEmpty); | 99 expect(errors, isEmpty); |
| 98 } | 100 } |
| 99 } | 101 } |
| 100 | 102 |
| 101 @reflectiveTest | 103 @reflectiveTest |
| 102 class AnalysisErrorIntegrationTest | |
| 103 extends AbstractAnalysisErrorIntegrationTest {} | |
| 104 | |
| 105 @reflectiveTest | |
| 106 class NoAnalysisErrorsIntegrationTest | 104 class NoAnalysisErrorsIntegrationTest |
| 107 extends AbstractAnalysisServerIntegrationTest { | 105 extends AbstractAnalysisServerIntegrationTest { |
| 108 @override | 106 @override |
| 109 Future startServer( | 107 Future startServer( |
| 110 {bool checked: true, int diagnosticPort, int servicesPort}) => | 108 {bool checked: true, int diagnosticPort, int servicesPort}) => |
| 111 server.start( | 109 server.start( |
| 112 checked: checked, | 110 checked: checked, |
| 113 diagnosticPort: diagnosticPort, | 111 diagnosticPort: diagnosticPort, |
| 114 enableNewAnalysisDriver: enableNewAnalysisDriver, | |
| 115 noErrorNotification: true, | 112 noErrorNotification: true, |
| 116 servicesPort: servicesPort); | 113 servicesPort: servicesPort); |
| 117 | 114 |
| 115 // Errors are reported with noErrorNotification: true (#28869). | |
| 116 @failingTest | |
| 118 test_detect_simple_error() { | 117 test_detect_simple_error() { |
| 119 String pathname = sourcePath('test.dart'); | 118 String pathname = sourcePath('test.dart'); |
| 120 writeFile( | 119 writeFile( |
| 121 pathname, | 120 pathname, |
| 122 ''' | 121 ''' |
| 123 main() { | 122 main() { |
| 124 print(null) // parse error: missing ';' | 123 print(null) // parse error: missing ';' |
| 125 }'''); | 124 }'''); |
| 126 standardAnalysisSetup(); | 125 standardAnalysisSetup(); |
| 127 return analysisFinished.then((_) { | 126 return analysisFinished.then((_) { |
| 128 expect(currentAnalysisErrors[pathname], isNull); | 127 expect(currentAnalysisErrors[pathname], isNull); |
| 129 }); | 128 }); |
| 130 } | 129 } |
| 131 } | 130 } |
| 132 | |
| 133 @reflectiveTest | |
| 134 class NoAnalysisErrorsIntegrationTest_Driver | |
| 135 extends NoAnalysisErrorsIntegrationTest { | |
| 136 @override | |
| 137 bool get enableNewAnalysisDriver => true; | |
| 138 | |
| 139 @failingTest | |
| 140 @override | |
| 141 test_detect_simple_error() { | |
| 142 return super.test_detect_simple_error(); | |
| 143 } | |
| 144 } | |
| OLD | NEW |