Create a base class for compile-time error code test cases.
This avoids the need to override tests in
CompileTimeErrorCodeTest_Driver to indicate that they pass.
Change-Id: Ieedb75c5d23edb3214b8d2cdb00a138201e3e3a7
Reviewed-on: https://dart-review.googlesource.com/75985
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_driver_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_driver_test.dart
index 09de9b5..e470236 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_driver_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_driver_test.dart
@@ -13,15 +13,98 @@
}
@reflectiveTest
-class CompileTimeErrorCodeTest_Driver extends CompileTimeErrorCodeTest {
+class CompileTimeErrorCodeTest_Driver extends CompileTimeErrorCodeTestBase {
@override
bool get enableNewAnalysisDriver => true;
- @override // Passes with driver
- test_mixinInference_recursiveSubtypeCheck() =>
- super.test_mixinInference_recursiveSubtypeCheck();
+ @override
+ @failingTest
+ test_awaitInWrongContext_sync() {
+ return super.test_awaitInWrongContext_sync();
+ }
- @override // Passes with driver
- test_mixinInference_recursiveSubtypeCheck_new_syntax() =>
- super.test_mixinInference_recursiveSubtypeCheck_new_syntax();
+ @override
+ @failingTest
+ test_constEvalThrowsException() {
+ return super.test_constEvalThrowsException();
+ }
+
+ @override
+ @failingTest
+ test_genericFunctionTypeArgument_typedef() {
+ return super.test_genericFunctionTypeArgument_typedef();
+ }
+
+ @override
+ @failingTest
+ test_invalidIdentifierInAsync_async() {
+ return super.test_invalidIdentifierInAsync_async();
+ }
+
+ @override
+ @failingTest
+ test_invalidIdentifierInAsync_await() {
+ return super.test_invalidIdentifierInAsync_await();
+ }
+
+ @override
+ @failingTest
+ test_invalidIdentifierInAsync_yield() {
+ return super.test_invalidIdentifierInAsync_yield();
+ }
+
+ @override
+ @failingTest
+ test_mixinInference_noMatchingClass_namedMixinApplication_new_syntax() {
+ return super
+ .test_mixinInference_noMatchingClass_namedMixinApplication_new_syntax();
+ }
+
+ @override
+ @failingTest
+ test_mixinInference_noMatchingClass_typeParametersSupplied() {
+ return super.test_mixinInference_noMatchingClass_typeParametersSupplied();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfNonClass() {
+ return super.test_mixinOfNonClass();
+ }
+
+ @override
+ @failingTest
+ test_objectCannotExtendAnotherClass() {
+ return super.test_objectCannotExtendAnotherClass();
+ }
+
+ @override
+ @failingTest
+ test_superInitializerInObject() {
+ return super.test_superInitializerInObject();
+ }
+
+ @override
+ @failingTest
+ test_yieldEachInNonGenerator_async() {
+ return super.test_yieldEachInNonGenerator_async();
+ }
+
+ @override
+ @failingTest
+ test_yieldEachInNonGenerator_sync() {
+ return super.test_yieldEachInNonGenerator_sync();
+ }
+
+ @override
+ @failingTest
+ test_yieldInNonGenerator_async() {
+ return super.test_yieldInNonGenerator_async();
+ }
+
+ @override
+ @failingTest
+ test_yieldInNonGenerator_sync() {
+ return super.test_yieldInNonGenerator_sync();
+ }
}
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index 1f7e5b9..c0cc727 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -21,92 +21,116 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(CompileTimeErrorCodeTest);
- defineReflectiveTests(CompileTimeErrorCodeSpecTest);
});
}
@reflectiveTest
-class CompileTimeErrorCodeSpecTest extends ResolverTestCase {
- test_constWithTypeParameters_direct() async {
- Source source = addSource(r'''
-class A<T> {
- static const V = const A<T>();
- const A();
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [
- CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
- StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC
- ]);
- verify([source]);
+class CompileTimeErrorCodeTest extends CompileTimeErrorCodeTestBase {
+ @override
+ @failingTest
+ test_awaitInWrongContext_sync() {
+ return super.test_awaitInWrongContext_sync();
}
- test_constWithTypeParameters_indirect() async {
- Source source = addSource(r'''
-class A<T> {
- static const V = const A<List<T>>();
- const A();
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [
- CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
- StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC
- ]);
- verify([source]);
+ @override
+ @failingTest
+ test_constEvalThrowsException() {
+ return super.test_constEvalThrowsException();
}
- test_invalidTypeArgumentInConstList() async {
- Source source = addSource(r'''
-class A<E> {
- m() {
- return const <E>[];
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(
- source, [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST]);
- verify([source]);
+ @override
+ @failingTest
+ test_genericFunctionTypeArgument_typedef() {
+ return super.test_genericFunctionTypeArgument_typedef();
}
- test_invalidTypeArgumentInConstMap() async {
- Source source = addSource(r'''
-class A<E> {
- m() {
- return const <String, E>{};
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(
- source, [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]);
- verify([source]);
+ @override
+ @failingTest
+ test_invalidIdentifierInAsync_async() {
+ return super.test_invalidIdentifierInAsync_async();
}
- test_mixinOfDisallowedClass_classTypeAlias_String_num() async {
- Source source = addSource(r'''
-class A {}
-class C = A with String, num;''');
- await computeAnalysisResult(source);
- if (previewDart2) {
- assertErrors(source, [
- StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_MIXIN,
- CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS,
- CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS
- ]);
- } else {
- assertErrors(source, [
- CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS,
- CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS
- ]);
- }
- verify([source]);
+ @override
+ @failingTest
+ test_invalidIdentifierInAsync_await() {
+ return super.test_invalidIdentifierInAsync_await();
+ }
+
+ @override
+ @failingTest
+ test_invalidIdentifierInAsync_yield() {
+ return super.test_invalidIdentifierInAsync_yield();
+ }
+
+ @override
+ @failingTest
+ test_mixinInference_noMatchingClass_namedMixinApplication_new_syntax() {
+ return super
+ .test_mixinInference_noMatchingClass_namedMixinApplication_new_syntax();
+ }
+
+ @override
+ @failingTest
+ test_mixinInference_noMatchingClass_typeParametersSupplied() {
+ return super.test_mixinInference_noMatchingClass_typeParametersSupplied();
+ }
+
+ @override
+ @failingTest // Does not work with old task model
+ test_mixinInference_recursiveSubtypeCheck() {
+ return super.test_mixinInference_recursiveSubtypeCheck();
+ }
+
+ @override
+ @failingTest // Does not work with old task model
+ test_mixinInference_recursiveSubtypeCheck_new_syntax() {
+ return super.test_mixinInference_recursiveSubtypeCheck_new_syntax();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfNonClass() {
+ return super.test_mixinOfNonClass();
+ }
+
+ @override
+ @failingTest
+ test_objectCannotExtendAnotherClass() {
+ return super.test_objectCannotExtendAnotherClass();
+ }
+
+ @override
+ @failingTest
+ test_superInitializerInObject() {
+ return super.test_superInitializerInObject();
+ }
+
+ @override
+ @failingTest
+ test_yieldEachInNonGenerator_async() {
+ return super.test_yieldEachInNonGenerator_async();
+ }
+
+ @override
+ @failingTest
+ test_yieldEachInNonGenerator_sync() {
+ return super.test_yieldEachInNonGenerator_sync();
+ }
+
+ @override
+ @failingTest
+ test_yieldInNonGenerator_async() {
+ return super.test_yieldInNonGenerator_async();
+ }
+
+ @override
+ @failingTest
+ test_yieldInNonGenerator_sync() {
+ return super.test_yieldInNonGenerator_sync();
}
}
-@reflectiveTest
-class CompileTimeErrorCodeTest extends ResolverTestCase {
- @override
- AnalysisOptions get defaultAnalysisOptions => new AnalysisOptionsImpl();
-
+class CompileTimeErrorCodeTestBase extends ResolverTestCase {
disabled_test_conflictingGenericInterfaces_hierarchyLoop_infinite() async {
// There is an interface conflict here due to a loop in the class
// hierarchy leading to an infinite set of implemented types; this loop
@@ -526,7 +550,6 @@
verify([source]);
}
- @failingTest
test_awaitInWrongContext_sync() async {
// This test requires better error recovery than we currently have. In
// particular, we need to be able to distinguish between an await expression
@@ -1078,7 +1101,6 @@
verify([source]);
}
- @failingTest
test_constEvalThrowsException() async {
Source source = addSource(r'''
class C {
@@ -1560,6 +1582,34 @@
verify([source1]);
}
+ test_constWithTypeParameters_direct() async {
+ Source source = addSource(r'''
+class A<T> {
+ static const V = const A<T>();
+ const A();
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
+ StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC
+ ]);
+ verify([source]);
+ }
+
+ test_constWithTypeParameters_indirect() async {
+ Source source = addSource(r'''
+class A<T> {
+ static const V = const A<List<T>>();
+ const A();
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ CompileTimeErrorCode.CONST_WITH_TYPE_PARAMETERS,
+ StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC
+ ]);
+ verify([source]);
+ }
+
test_constWithUndefinedConstructor() async {
Source source = addSource(r'''
class A {
@@ -2449,7 +2499,6 @@
verify([source]);
}
- @failingTest
test_genericFunctionTypeArgument_typedef() async {
// TODO(mfairhurst) diagnose these parse errors to give the correct error
Source source = addSource(r'''
@@ -3341,7 +3390,6 @@
// no verify() call, "B" is not resolved
}
- @failingTest
test_invalidIdentifierInAsync_async() async {
// TODO(brianwilkerson) Report this error.
Source source = addSource(r'''
@@ -3355,7 +3403,6 @@
verify([source]);
}
- @failingTest
test_invalidIdentifierInAsync_await() async {
// TODO(brianwilkerson) Report this error.
Source source = addSource(r'''
@@ -3369,7 +3416,6 @@
verify([source]);
}
- @failingTest
test_invalidIdentifierInAsync_yield() async {
// TODO(brianwilkerson) Report this error.
Source source = addSource(r'''
@@ -3589,6 +3635,32 @@
verify([source]);
}
+ test_invalidTypeArgumentInConstList() async {
+ Source source = addSource(r'''
+class A<E> {
+ m() {
+ return const <E>[];
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_LIST]);
+ verify([source]);
+ }
+
+ test_invalidTypeArgumentInConstMap() async {
+ Source source = addSource(r'''
+class A<E> {
+ m() {
+ return const <String, E>{};
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.INVALID_TYPE_ARGUMENT_IN_CONST_MAP]);
+ verify([source]);
+ }
+
test_invalidUri_export() async {
Source source = addSource("export 'ht:';");
await computeAnalysisResult(source);
@@ -3876,7 +3948,6 @@
source, [CompileTimeErrorCode.MIXIN_INFERENCE_NO_MATCHING_CLASS]);
}
- @failingTest
test_mixinInference_noMatchingClass_namedMixinApplication_new_syntax() async {
Source source = addSource('''
abstract class A<T> {}
@@ -3926,7 +3997,6 @@
assertNoErrors(source);
}
- @failingTest
test_mixinInference_noMatchingClass_typeParametersSupplied() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.enableSuperMixins = true;
@@ -3954,7 +4024,6 @@
[CompileTimeErrorCode.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE]);
}
- @failingTest // Does not work with old task model
test_mixinInference_recursiveSubtypeCheck() async {
// See dartbug.com/32353 for a detailed explanation.
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
@@ -3993,7 +4062,6 @@
expect(mixins[0].toString(), 'ForwardingDirectory<_LocalDirectory>');
}
- @failingTest // Does not work with old task model
test_mixinInference_recursiveSubtypeCheck_new_syntax() async {
// See dartbug.com/32353 for a detailed explanation.
Source source = addSource('''
@@ -4165,7 +4233,26 @@
verify([source]);
}
- @failingTest
+ test_mixinOfDisallowedClass_classTypeAlias_String_num() async {
+ Source source = addSource(r'''
+class A {}
+class C = A with String, num;''');
+ await computeAnalysisResult(source);
+ if (previewDart2) {
+ assertErrors(source, [
+ StrongModeCode.INVALID_METHOD_OVERRIDE_FROM_MIXIN,
+ CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS,
+ CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS
+ ]);
+ } else {
+ assertErrors(source, [
+ CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS,
+ CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS
+ ]);
+ }
+ verify([source]);
+ }
+
test_mixinOfNonClass() async {
// TODO(brianwilkerson) Compare with MIXIN_WITH_NON_CLASS_SUPERCLASS.
Source source = addSource(r'''
@@ -4999,7 +5086,6 @@
verify([source]);
}
- @failingTest
test_objectCannotExtendAnotherClass() async {
Source source = addSource(r'''
''');
@@ -5979,7 +6065,6 @@
// no verify(), 'super.y' is not resolved
}
- @failingTest
test_superInitializerInObject() async {
Source source = addSource(r'''
''');
@@ -6523,7 +6608,6 @@
verify([source]);
}
- @failingTest
test_yieldEachInNonGenerator_async() async {
// TODO(brianwilkerson) We are currently parsing the yield statement as a
// binary expression.
@@ -6536,7 +6620,6 @@
verify([source]);
}
- @failingTest
test_yieldEachInNonGenerator_sync() async {
// TODO(brianwilkerson) We are currently parsing the yield statement as a
// binary expression.
@@ -6549,7 +6632,6 @@
verify([source]);
}
- @failingTest
test_yieldInNonGenerator_async() async {
// TODO(brianwilkerson) We are currently trying to parse the yield statement
// as a binary expression.
@@ -6562,7 +6644,6 @@
verify([source]);
}
- @failingTest
test_yieldInNonGenerator_sync() async {
// TODO(brianwilkerson) We are currently trying to parse the yield statement
// as a binary expression.