| Index: pkg/analyzer/test/generated/incremental_resolver_test.dart
|
| diff --git a/pkg/analyzer/test/generated/incremental_resolver_test.dart b/pkg/analyzer/test/generated/incremental_resolver_test.dart
|
| index 03309ddd504a80e9ed2fc84f0b018a4669028c53..c1730ec4e3bfd96cffcd9318a55d487221908b09 100644
|
| --- a/pkg/analyzer/test/generated/incremental_resolver_test.dart
|
| +++ b/pkg/analyzer/test/generated/incremental_resolver_test.dart
|
| @@ -9,7 +9,6 @@ import 'package:analyzer/dart/ast/token.dart';
|
| import 'package:analyzer/dart/element/element.dart';
|
| import 'package:analyzer/src/context/cache.dart';
|
| import 'package:analyzer/src/dart/ast/utilities.dart';
|
| -import 'package:analyzer/src/dart/element/builder.dart';
|
| import 'package:analyzer/src/dart/element/element.dart';
|
| import 'package:analyzer/src/dart/scanner/reader.dart';
|
| import 'package:analyzer/src/dart/scanner/scanner.dart';
|
| @@ -37,7 +36,6 @@ import 'test_support.dart';
|
|
|
| main() {
|
| initializeTestEnvironment();
|
| - runReflectiveTests(DeclarationMatcherTest);
|
| runReflectiveTests(IncrementalResolverTest);
|
| runReflectiveTests(PoorMansIncrementalResolutionTest);
|
| runReflectiveTests(ResolutionContextBuilderTest);
|
| @@ -138,2976 +136,6 @@ void _checkCacheEntries(AnalysisCache cache) {
|
| }
|
|
|
| @reflectiveTest
|
| -class DeclarationMatcherTest extends ResolverTestCase {
|
| - void setUp() {
|
| - super.setUp();
|
| - test_resolveApiChanges = true;
|
| - }
|
| -
|
| - void test_false_class_annotation_accessor_edit() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -const my_annotationA = const Object();
|
| -const my_annotationB = const Object();
|
| -@my_annotationA
|
| -class A {
|
| -}
|
| -''',
|
| - r'''
|
| -const my_annotationA = const Object();
|
| -const my_annotationB = const Object();
|
| -@my_annotationB
|
| -class A {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_class_annotation_constructor_edit() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class MyAnnotationA {
|
| - const MyAnnotationA();
|
| -}
|
| -class MyAnnotationB {
|
| - const MyAnnotationB();
|
| -}
|
| -@MyAnnotationA()
|
| -class A {
|
| -}
|
| -''',
|
| - r'''
|
| -class MyAnnotationA {
|
| - const MyAnnotationA();
|
| -}
|
| -class MyAnnotationB {
|
| - const MyAnnotationB();
|
| -}
|
| -@MyAnnotationB()
|
| -class A {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_class_annotations_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -const my_annotation = const Object();
|
| -class A {
|
| -}
|
| -''',
|
| - r'''
|
| -const my_annotation = const Object();
|
| -@my_annotation
|
| -class A {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_class_annotations_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -const my_annotation = const Object();
|
| -@my_annotation
|
| -class A {
|
| -}
|
| -''',
|
| - r'''
|
| -const my_annotation = const Object();
|
| -class A {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_class_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -class C {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_class_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -class C {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_class_typeParameters_bounds_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B<T> {
|
| - T f;
|
| -}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B<T extends A> {
|
| - T f;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_class_typeParameters_bounds_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B<T extends A> {
|
| - T f;
|
| -}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B<T> {
|
| - T f;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_classMemberAccessor_list_add() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - get a => 1;
|
| - get b => 2;
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - get a => 1;
|
| - get b => 2;
|
| - get c => 3;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_classMemberAccessor_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - get a => 1;
|
| - get b => 2;
|
| - get c => 3;
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - get a => 1;
|
| - get b => 2;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_classMemberAccessor_wasGetter() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - get a => 1;
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - set a(x) {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_classMemberAccessor_wasInstance() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - get a => 1;
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - static get a => 1;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_classMemberAccessor_wasSetter() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - set a(x) {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - get a => 1;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_classMemberAccessor_wasStatic() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - static get a => 1;
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - get a => 1;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_classTypeAlias_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class M {}
|
| -class A = Object with M;
|
| -''',
|
| - r'''
|
| -class M {}
|
| -class A = Object with M;
|
| -class B = Object with M;
|
| -''');
|
| - }
|
| -
|
| - void test_false_classTypeAlias_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class M {}
|
| -class A = Object with M;
|
| -class B = Object with M;
|
| -''',
|
| - r'''
|
| -class M {}
|
| -class A = Object with M;
|
| -''');
|
| - }
|
| -
|
| - void test_false_classTypeAlias_typeParameters_bounds_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class M<T> {}
|
| -class A {}
|
| -class B<T> = Object with M<T>;
|
| -''',
|
| - r'''
|
| -class M<T> {}
|
| -class A {}
|
| -class B<T extends A> = Object with M<T>;
|
| -''');
|
| - }
|
| -
|
| - void test_false_classTypeAlias_typeParameters_bounds_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class M<T> {}
|
| -class A {}
|
| -class B<T extends A> = Object with M<T>;
|
| -''',
|
| - r'''
|
| -class M<T> {}
|
| -class A {}
|
| -class B<T> = Object with M<T>;
|
| -''');
|
| - }
|
| -
|
| - void test_false_constructor_keywordConst_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - A();
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - const A();
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_constructor_keywordConst_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - const A();
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A();
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_constructor_keywordFactory_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - A();
|
| - A.foo() {
|
| - return new A();
|
| - }
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A();
|
| - factory A.foo() {
|
| - return new A();
|
| - }
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_constructor_keywordFactory_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - A();
|
| - factory A.foo() {
|
| - return new A();
|
| - }
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A();
|
| - A.foo() {
|
| - return new A();
|
| - }
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_constructor_parameters_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - A();
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A(int p);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_constructor_parameters_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - A(int p);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A();
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_constructor_parameters_name() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - A(int a);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A(int b);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_constructor_parameters_type_edit() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - A(int p);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A(String p);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_constructor_unnamed_add_hadParameters() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A(int p) {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_constructor_unnamed_remove_hadParameters() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - A(int p) {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_defaultFieldFormalParameterElement_wasSimple() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - int field;
|
| - A(int field);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - int field;
|
| - A([this.field = 0]);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_enum_constants_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -enum E {A, B}
|
| -''',
|
| - r'''
|
| -enum E {A, B, C}
|
| -''');
|
| - }
|
| -
|
| - void test_false_enum_constants_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -enum E {A, B, C}
|
| -''',
|
| - r'''
|
| -enum E {A, B}
|
| -''');
|
| - }
|
| -
|
| - void test_false_export_hide_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -export 'dart:async' hide Future;
|
| -''',
|
| - r'''
|
| -export 'dart:async' hide Future, Stream;
|
| -''');
|
| - }
|
| -
|
| - void test_false_export_hide_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -export 'dart:async' hide Future, Stream;
|
| -''',
|
| - r'''
|
| -export 'dart:async' hide Future;
|
| -''');
|
| - }
|
| -
|
| - void test_false_export_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -export 'dart:async';
|
| -''',
|
| - r'''
|
| -export 'dart:async';
|
| -export 'dart:math';
|
| -''');
|
| - }
|
| -
|
| - void test_false_export_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -export 'dart:async';
|
| -export 'dart:math';
|
| -''',
|
| - r'''
|
| -export 'dart:async';
|
| -''');
|
| - }
|
| -
|
| - void test_false_export_show_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -export 'dart:async' show Future;
|
| -''',
|
| - r'''
|
| -export 'dart:async' show Future, Stream;
|
| -''');
|
| - }
|
| -
|
| - void test_false_export_show_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -export 'dart:async' show Future, Stream;
|
| -''',
|
| - r'''
|
| -export 'dart:async' show Future;
|
| -''');
|
| - }
|
| -
|
| - void test_false_extendsClause_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B extends A {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_extendsClause_different() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -class C extends A {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -class C extends B {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_extendsClause_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B extends A{}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_field_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class T {
|
| - int A = 1;
|
| - int C = 3;
|
| -}
|
| -''',
|
| - r'''
|
| -class T {
|
| - int A = 1;
|
| - int B = 2;
|
| - int C = 3;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_field_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class T {
|
| - int A = 1;
|
| - int B = 2;
|
| - int C = 3;
|
| -}
|
| -''',
|
| - r'''
|
| -class T {
|
| - int A = 1;
|
| - int C = 3;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_field_modifier_isConst() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class T {
|
| - static final A = 1;
|
| -}
|
| -''',
|
| - r'''
|
| -class T {
|
| - static const A = 1;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_field_modifier_isFinal() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class T {
|
| - int A = 1;
|
| -}
|
| -''',
|
| - r'''
|
| -class T {
|
| - final int A = 1;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_field_modifier_isStatic() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class T {
|
| - int A = 1;
|
| -}
|
| -''',
|
| - r'''
|
| -class T {
|
| - static int A = 1;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_field_modifier_wasConst() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class T {
|
| - static const A = 1;
|
| -}
|
| -''',
|
| - r'''
|
| -class T {
|
| - static final A = 1;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_field_modifier_wasFinal() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class T {
|
| - final int A = 1;
|
| -}
|
| -''',
|
| - r'''
|
| -class T {
|
| - int A = 1;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_field_modifier_wasStatic() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class T {
|
| - static int A = 1;
|
| -}
|
| -''',
|
| - r'''
|
| -class T {
|
| - int A = 1;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_field_type_differentArgs() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class T {
|
| - List<int> A;
|
| -}
|
| -''',
|
| - r'''
|
| -class T {
|
| - List<String> A;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(field);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(this.field);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_add_function() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(field(a));
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(this.field(a));
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_changeName_wasUnresolvedField() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final fff;
|
| - A(this.unresolved);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final fff;
|
| - A(this.fff);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_differentField() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final aaa;
|
| - final bbb;
|
| - A(this.aaa, this.bbb);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final aaa;
|
| - final bbb;
|
| - A(this.bbb, this.aaa);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_parameters_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(this.field(a));
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(this.field(a, b));
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_parameters_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(this.field(a, b));
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(this.field(a));
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_parameters_typeEdit() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(this.field(int p));
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(this.field(String p));
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_remove_default() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A([this.field = 0]);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A([field = 0]);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_remove_function() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(this.field(a));
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(field(a));
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_remove_normal() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(this.field);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(field);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_typeAdd() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final fff;
|
| - A(this.fff);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final fff;
|
| - A(int this.fff);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_typeEdit() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final fff;
|
| - A(int this.fff);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final fff;
|
| - A(String this.fff);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameter_typeRemove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - final fff;
|
| - A(int this.fff);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final fff;
|
| - A(this.fff);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_fieldFormalParameterElement_wasSimple() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - int field;
|
| - A(int field);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - int field;
|
| - A(this.field);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_final_type_different() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class T {
|
| - int A;
|
| -}
|
| -''',
|
| - r'''
|
| -class T {
|
| - String A;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_function_async_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main() {}
|
| -''',
|
| - r'''
|
| -main() async {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_function_async_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main() async {}
|
| -''',
|
| - r'''
|
| -main() {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_function_generator_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main() async {}
|
| -''',
|
| - r'''
|
| -main() async* {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_function_generator_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main() async* {}
|
| -''',
|
| - r'''
|
| -main() async {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_functionTypeAlias_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -typedef A(int pa);
|
| -typedef B(String pb);
|
| -''',
|
| - r'''
|
| -typedef A(int pa);
|
| -typedef B(String pb);
|
| -typedef C(pc);
|
| -''');
|
| - }
|
| -
|
| - void test_false_functionTypeAlias_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -typedef A(int pa);
|
| -typedef B(String pb);
|
| -typedef C(pc);
|
| -''',
|
| - r'''
|
| -typedef A(int pa);
|
| -typedef B(String pb);
|
| -''');
|
| - }
|
| -
|
| - void test_false_functionTypeAlias_parameters_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -typedef A(a);
|
| -''',
|
| - r'''
|
| -typedef A(a, b);
|
| -''');
|
| - }
|
| -
|
| - void test_false_functionTypeAlias_parameters_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -typedef A(a, b);
|
| -''',
|
| - r'''
|
| -typedef A(a);
|
| -''');
|
| - }
|
| -
|
| - void test_false_functionTypeAlias_parameters_type_edit() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -typedef A(int p);
|
| -''',
|
| - r'''
|
| -typedef A(String p);
|
| -''');
|
| - }
|
| -
|
| - void test_false_functionTypeAlias_returnType_edit() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -typedef int A();
|
| -''',
|
| - r'''
|
| -typedef String A();
|
| -''');
|
| - }
|
| -
|
| - void test_false_functionTypeAlias_typeParameters_bounds_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -typedef F<T>();
|
| -''',
|
| - r'''
|
| -class A {}
|
| -typedef F<T extends A>();
|
| -''');
|
| - }
|
| -
|
| - void test_false_functionTypeAlias_typeParameters_bounds_edit() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -typedef F<T extends A>();
|
| -''',
|
| - r'''
|
| -class A {}
|
| -typedef F<T extends B>();
|
| -''');
|
| - }
|
| -
|
| - void test_false_functionTypeAlias_typeParameters_bounds_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -typedef F<T extends A>();
|
| -''',
|
| - r'''
|
| -class A {}
|
| -typedef F<T>();
|
| -''');
|
| - }
|
| -
|
| - void test_false_functionTypeAlias_typeParameters_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -typedef F<A>();
|
| -''',
|
| - r'''
|
| -typedef F<A, B>();
|
| -''');
|
| - }
|
| -
|
| - void test_false_functionTypeAlias_typeParameters_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -typedef F<A, B>();
|
| -''',
|
| - r'''
|
| -typedef F<A>();
|
| -''');
|
| - }
|
| -
|
| - void test_false_FunctionTypedFormalParameter_parameters_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main(int callback(int a)) {
|
| -}
|
| -''',
|
| - r'''
|
| -main(int callback(int a, String b)) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_FunctionTypedFormalParameter_parameters_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main(int callback(int a, String b)) {
|
| -}
|
| -''',
|
| - r'''
|
| -main(int callback(int a)) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_FunctionTypedFormalParameter_parameterType() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main(int callback(int p)) {
|
| -}
|
| -''',
|
| - r'''
|
| -main(int callback(String p)) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_FunctionTypedFormalParameter_returnType() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main(int callback()) {
|
| -}
|
| -''',
|
| - r'''
|
| -main(String callback()) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_FunctionTypedFormalParameter_wasSimple() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main(int callback) {
|
| -}
|
| -''',
|
| - r'''
|
| -main(int callback(int a, String b)) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_getter_body_add() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - int get foo;
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - int get foo => 0;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_getter_body_remove() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - int get foo => 0;
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - int get foo;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_implementsClause_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B implements A {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_implementsClause_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B implements A {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_implementsClause_reorder() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -class C implements A, B {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -class C implements B, A {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_import_hide_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -import 'dart:async' hide Future;
|
| -''',
|
| - r'''
|
| -import 'dart:async' hide Future, Stream;
|
| -''');
|
| - }
|
| -
|
| - void test_false_import_hide_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -import 'dart:async' hide Future, Stream;
|
| -''',
|
| - r'''
|
| -import 'dart:async' hide Future;
|
| -''');
|
| - }
|
| -
|
| - void test_false_import_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -import 'dart:async';
|
| -''',
|
| - r'''
|
| -import 'dart:async';
|
| -import 'dart:math';
|
| -''');
|
| - }
|
| -
|
| - void test_false_import_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -import 'dart:async';
|
| -import 'dart:math';
|
| -''',
|
| - r'''
|
| -import 'dart:async';
|
| -''');
|
| - }
|
| -
|
| - void test_false_import_prefix_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -import 'dart:async';
|
| -''',
|
| - r'''
|
| -import 'dart:async' as async;
|
| -''');
|
| - }
|
| -
|
| - void test_false_import_prefix_edit() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -import 'dart:async' as oldPrefix;
|
| -''',
|
| - r'''
|
| -import 'dart:async' as newPrefix;
|
| -''');
|
| - }
|
| -
|
| - void test_false_import_prefix_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -import 'dart:async' as async;
|
| -''',
|
| - r'''
|
| -import 'dart:async';
|
| -''');
|
| - }
|
| -
|
| - void test_false_import_show_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -import 'dart:async' show Future;
|
| -''',
|
| - r'''
|
| -import 'dart:async' show Future, Stream;
|
| -''');
|
| - }
|
| -
|
| - void test_false_import_show_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -import 'dart:async' show Future, Stream;
|
| -''',
|
| - r'''
|
| -import 'dart:async' show Future;
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_annotation_edit() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -const my_annotationA = const Object();
|
| -const my_annotationB = const Object();
|
| -class A {
|
| - @my_annotationA
|
| - void m() {}
|
| -}
|
| -''',
|
| - r'''
|
| -const my_annotationA = const Object();
|
| -const my_annotationB = const Object();
|
| -class A {
|
| - @my_annotationB
|
| - void m() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_annotations_add() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -const my_annotation = const Object();
|
| -class A {
|
| - void m() {}
|
| -}
|
| -''',
|
| - r'''
|
| -const my_annotation = const Object();
|
| -class A {
|
| - @my_annotation
|
| - void m() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_annotations_remove() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -const my_annotation = const Object();
|
| -class A {
|
| - @my_annotation
|
| - void m() {}
|
| -}
|
| -''',
|
| - r'''
|
| -const my_annotation = const Object();
|
| -class A {
|
| - void m() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_async_add() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - m() {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - m() async {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_async_remove() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - m() async {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - m() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_body_add() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - void foo();
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - void foo() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_body_remove() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - void foo() {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - void foo();
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_generator_add() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - m() async {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - m() async* {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_generator_remove() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - m() async* {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - m() async {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_getKeyword_add() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - void foo() {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - void get foo {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_getKeyword_remove() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - void get foo {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - void foo() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_list_add() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - a() {}
|
| - b() {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - a() {}
|
| - b() {}
|
| - c() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - a() {}
|
| - b() {}
|
| - c() {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - a() {}
|
| - b() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_parameters_type_edit() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - m(int p) {
|
| - }
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - m(String p) {
|
| - }
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_parameters_type_edit_insertImportPrefix() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -import 'dart:async' as a;
|
| -
|
| -class C {
|
| - void foo(Future f) {}
|
| -}
|
| -
|
| -class Future {}
|
| -
|
| -bar(C c, a.Future f) {
|
| - c.foo(f);
|
| -}
|
| -''',
|
| - r'''
|
| -import 'dart:async' as a;
|
| -
|
| -class C {
|
| - void foo(a.Future f) {}
|
| -}
|
| -
|
| -class Future {}
|
| -
|
| -bar(C c, a.Future f) {
|
| - c.foo(f);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_returnType_edit() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - int m() {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - String m() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_setKeyword_add() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - void foo(x) {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - void set foo(x) {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_method_setKeyword_remove() {
|
| - _assertDoesNotMatchOK(
|
| - r'''
|
| -class A {
|
| - void set foo(x) {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - void foo(x) {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_part_list_add() {
|
| - addNamedSource('/unitA.dart', 'part of lib; class A {}');
|
| - addNamedSource('/unitB.dart', 'part of lib; class B {}');
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -library lib;
|
| -part 'unitA.dart';
|
| -''',
|
| - r'''
|
| -library lib;
|
| -part 'unitA.dart';
|
| -part 'unitB.dart';
|
| -''');
|
| - }
|
| -
|
| - void test_false_part_list_remove() {
|
| - addNamedSource('/unitA.dart', 'part of lib; class A {}');
|
| - addNamedSource('/unitB.dart', 'part of lib; class B {}');
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -library lib;
|
| -part 'unitA.dart';
|
| -part 'unitB.dart';
|
| -''',
|
| - r'''
|
| -library lib;
|
| -part 'unitA.dart';
|
| -''');
|
| - }
|
| -
|
| - void test_false_SimpleFormalParameter_named_differentName() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main({int oldName}) {
|
| -}
|
| -''',
|
| - r'''
|
| -main({int newName}) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_SimpleFormalParameter_namedDefault_addValue() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main({int p}) {
|
| -}
|
| -''',
|
| - r'''
|
| -main({int p: 2}) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_SimpleFormalParameter_namedDefault_differentValue() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main({int p: 1}) {
|
| -}
|
| -''',
|
| - r'''
|
| -main({int p: 2}) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_SimpleFormalParameter_namedDefault_removeValue() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main({int p: 1}) {
|
| -}
|
| -''',
|
| - r'''
|
| -main({int p}) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_SimpleFormalParameter_optionalDefault_addValue() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main([int p]) {
|
| -}
|
| -''',
|
| - r'''
|
| -main([int p = 2]) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_SimpleFormalParameter_optionalDefault_differentValue() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main([int p = 1]) {
|
| -}
|
| -''',
|
| - r'''
|
| -main([int p = 2]) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_SimpleFormalParameter_optionalDefault_removeValue() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main([int p = 1]) {
|
| -}
|
| -''',
|
| - r'''
|
| -main([int p]) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelAccessor_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -get a => 1;
|
| -get b => 2;
|
| -''',
|
| - r'''
|
| -get a => 1;
|
| -get b => 2;
|
| -get c => 3;
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelAccessor_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -get a => 1;
|
| -get b => 2;
|
| -get c => 3;
|
| -''',
|
| - r'''
|
| -get a => 1;
|
| -get b => 2;
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelAccessor_wasGetter() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -get a => 1;
|
| -''',
|
| - r'''
|
| -set a(x) {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelAccessor_wasSetter() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -set a(x) {}
|
| -''',
|
| - r'''
|
| -get a => 1;
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelFunction_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -a() {}
|
| -b() {}
|
| -''',
|
| - r'''
|
| -a() {}
|
| -b() {}
|
| -c() {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelFunction_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -a() {}
|
| -b() {}
|
| -c() {}
|
| -''',
|
| - r'''
|
| -a() {}
|
| -b() {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelFunction_parameters_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main(int a, int b) {
|
| -}
|
| -''',
|
| - r'''
|
| -main(int a, int b, int c) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelFunction_parameters_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main(int a, int b, int c) {
|
| -}
|
| -''',
|
| - r'''
|
| -main(int a, int b) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelFunction_parameters_type_edit() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -main(int a, int b, int c) {
|
| -}
|
| -''',
|
| - r'''
|
| -main(int a, String b, int c) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelFunction_returnType_edit() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -int a() {}
|
| -''',
|
| - r'''
|
| -String a() {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelVariable_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -const int A = 1;
|
| -const int C = 3;
|
| -''',
|
| - r'''
|
| -const int A = 1;
|
| -const int B = 2;
|
| -const int C = 3;
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelVariable_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -const int A = 1;
|
| -const int B = 2;
|
| -const int C = 3;
|
| -''',
|
| - r'''
|
| -const int A = 1;
|
| -const int C = 3;
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelVariable_modifier_isConst() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -final int A = 1;
|
| -''',
|
| - r'''
|
| -const int A = 1;
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelVariable_modifier_isFinal() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -int A = 1;
|
| -''',
|
| - r'''
|
| -final int A = 1;
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelVariable_modifier_wasConst() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -const int A = 1;
|
| -''',
|
| - r'''
|
| -final int A = 1;
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelVariable_modifier_wasFinal() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -final int A = 1;
|
| -''',
|
| - r'''
|
| -int A = 1;
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelVariable_synthetic_wasGetter() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -int get A => 1;
|
| -''',
|
| - r'''
|
| -final int A = 1;
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelVariable_type_different() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -int A;
|
| -''',
|
| - r'''
|
| -String A;
|
| -''');
|
| - }
|
| -
|
| - void test_false_topLevelVariable_type_differentArgs() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -List<int> A;
|
| -''',
|
| - r'''
|
| -List<String> A;
|
| -''');
|
| - }
|
| -
|
| - void test_false_type_noTypeArguments_hadTypeArguments() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A<T> {}
|
| -A<int> main() {
|
| -}
|
| -''',
|
| - r'''
|
| -class A<T> {}
|
| -A main() {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_false_withClause_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B extends Object with A {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_withClause_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B extends Object with A {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -''');
|
| - }
|
| -
|
| - void test_false_withClause_reorder() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -class C extends Object with A, B {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -class C extends Object with B, A {}
|
| -''');
|
| - }
|
| -
|
| - void test_true_class_annotations_same() {
|
| - _assertMatches(
|
| - r'''
|
| -const my_annotation = const Object();
|
| -@my_annotation
|
| -class A {
|
| -}
|
| -''',
|
| - r'''
|
| -const my_annotation = const Object();
|
| -@my_annotation
|
| -class A {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_class_list_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -class C {}
|
| -''',
|
| - r'''
|
| -class C {}
|
| -class A {}
|
| -class B {}
|
| -''');
|
| - }
|
| -
|
| - void test_true_class_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -class C {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B {}
|
| -class C {}
|
| -''');
|
| - }
|
| -
|
| - void test_true_class_typeParameters_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class A<T> {}
|
| -''',
|
| - r'''
|
| -class A<T> {}
|
| -''');
|
| - }
|
| -
|
| - void test_true_classMemberAccessor_getterSetter() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - int _test;
|
| - get test => _test;
|
| - set test(v) {
|
| - _test = v;
|
| - }
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - int _test;
|
| - get test => _test;
|
| - set test(v) {
|
| - _test = v;
|
| - }
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_classMemberAccessor_list_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - get a => 1;
|
| - get b => 2;
|
| - get c => 3;
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - get c => 3;
|
| - get a => 1;
|
| - get b => 2;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_classMemberAccessor_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - get a => 1;
|
| - get b => 2;
|
| - get c => 3;
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - get a => 1;
|
| - get b => 2;
|
| - get c => 3;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_classTypeAlias_list_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -class M {}
|
| -class A = Object with M;
|
| -class B = Object with M;
|
| -class C = Object with M;
|
| -''',
|
| - r'''
|
| -class M {}
|
| -class C = Object with M;
|
| -class A = Object with M;
|
| -class B = Object with M;
|
| -''');
|
| - }
|
| -
|
| - void test_true_classTypeAlias_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class M {}
|
| -class A = Object with M;
|
| -class B = Object with M;
|
| -class C = Object with M;
|
| -''',
|
| - r'''
|
| -class M {}
|
| -class A = Object with M;
|
| -class B = Object with M;
|
| -class C = Object with M;
|
| -''');
|
| - }
|
| -
|
| - void test_true_classTypeAlias_typeParameters_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class M<T> {}
|
| -class A<T> {}
|
| -class B<T> = A<T> with M<T>;
|
| -''',
|
| - r'''
|
| -class M<T> {}
|
| -class A<T> {}
|
| -class B<T> = A<T> with M<T>;
|
| -''');
|
| - }
|
| -
|
| - void test_true_constructor_body_add() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - A(int p);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A(int p) {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_constructor_body_remove() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - A(int p) {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A(int p);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_constructor_named_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - A.name(int p);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A.name(int p);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_constructor_unnamed_add_noParameters() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_constructor_unnamed_remove_noParameters() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - A() {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_constructor_unnamed_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - A(int p);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A(int p);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_defaultFieldFormalParameterElement() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - int field;
|
| - A([this.field = 0]);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - int field;
|
| - A([this.field = 0]);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_enum_constants_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -enum E {A, B, C}
|
| -''',
|
| - r'''
|
| -enum E {C, A, B}
|
| -''');
|
| - }
|
| -
|
| - void test_true_enum_list_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -enum A {A1, A2, A3}
|
| -enum B {B1, B2, B3}
|
| -enum C {C1, C2, C3}
|
| -''',
|
| - r'''
|
| -enum C {C1, C2, C3}
|
| -enum A {A1, A2, A3}
|
| -enum B {B1, B2, B3}
|
| -''');
|
| - }
|
| -
|
| - void test_true_enum_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -enum A {A1, A2, A3}
|
| -enum B {B1, B2, B3}
|
| -enum C {C1, C2, C3}
|
| -''',
|
| - r'''
|
| -enum A {A1, A2, A3}
|
| -enum B {B1, B2, B3}
|
| -enum C {C1, C2, C3}
|
| -''');
|
| - }
|
| -
|
| - void test_true_executable_same_hasLabel() {
|
| - _assertMatches(
|
| - r'''
|
| -main() {
|
| - label: return 42;
|
| -}
|
| -''',
|
| - r'''
|
| -main() {
|
| - label: return 42;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_executable_same_hasLocalVariable() {
|
| - _assertMatches(
|
| - r'''
|
| -main() {
|
| - int a = 42;
|
| -}
|
| -''',
|
| - r'''
|
| -main() {
|
| - int a = 42;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_export_hide_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -export 'dart:async' hide Future, Stream;
|
| -''',
|
| - r'''
|
| -export 'dart:async' hide Stream, Future;
|
| -''');
|
| - }
|
| -
|
| - void test_true_export_list_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -export 'dart:async';
|
| -export 'dart:math';
|
| -''',
|
| - r'''
|
| -export 'dart:math';
|
| -export 'dart:async';
|
| -''');
|
| - }
|
| -
|
| - void test_true_export_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -export 'dart:async';
|
| -export 'dart:math';
|
| -''',
|
| - r'''
|
| -export 'dart:async';
|
| -export 'dart:math';
|
| -''');
|
| - }
|
| -
|
| - void test_true_export_show_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -export 'dart:async' show Future, Stream;
|
| -''',
|
| - r'''
|
| -export 'dart:async' show Stream, Future;
|
| -''');
|
| - }
|
| -
|
| - void test_true_extendsClause_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {}
|
| -class B extends A {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B extends A {}
|
| -''');
|
| - }
|
| -
|
| - void test_true_field_list_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -class T {
|
| - int A = 1;
|
| - int B = 2;
|
| - int C = 3;
|
| -}
|
| -''',
|
| - r'''
|
| -class T {
|
| - int C = 3;
|
| - int A = 1;
|
| - int B = 2;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_field_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class T {
|
| - int A = 1;
|
| - int B = 2;
|
| - int C = 3;
|
| -}
|
| -''',
|
| - r'''
|
| -class T {
|
| - int A = 1;
|
| - int B = 2;
|
| - int C = 3;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_fieldFormalParameter() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - int field;
|
| - A(this.field);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - int field;
|
| - A(this.field);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_fieldFormalParameter_function() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(this.field(int a, String b));
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final field;
|
| - A(this.field(int a, String b));
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_functionTypeAlias_list_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -typedef A(int pa);
|
| -typedef B(String pb);
|
| -typedef C(pc);
|
| -''',
|
| - r'''
|
| -typedef C(pc);
|
| -typedef A(int pa);
|
| -typedef B(String pb);
|
| -''');
|
| - }
|
| -
|
| - void test_true_functionTypeAlias_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -typedef String A(int pa);
|
| -typedef int B(String pb);
|
| -typedef C(pc);
|
| -''',
|
| - r'''
|
| -typedef String A(int pa);
|
| -typedef int B(String pb);
|
| -typedef C(pc);
|
| -''');
|
| - }
|
| -
|
| - void test_true_functionTypeAlias_typeParameters_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -typedef F<A, B, C>();
|
| -''',
|
| - r'''
|
| -typedef F<A, B, C>();
|
| -''');
|
| - }
|
| -
|
| - void test_true_FunctionTypedFormalParameter() {
|
| - _assertMatches(
|
| - r'''
|
| -main(int callback(int a, String b)) {
|
| -}
|
| -''',
|
| - r'''
|
| -main(int callback(int a, String b)) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_implementsClause_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {}
|
| -class B implements A {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B implements A {}
|
| -''');
|
| - }
|
| -
|
| - void test_true_import_hide_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -import 'dart:async' hide Future, Stream;
|
| -''',
|
| - r'''
|
| -import 'dart:async' hide Stream, Future;
|
| -''');
|
| - }
|
| -
|
| - void test_true_import_list_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -import 'dart:async';
|
| -import 'dart:math';
|
| -''',
|
| - r'''
|
| -import 'dart:math';
|
| -import 'dart:async';
|
| -''');
|
| - }
|
| -
|
| - void test_true_import_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -import 'dart:async';
|
| -import 'dart:math';
|
| -''',
|
| - r'''
|
| -import 'dart:async';
|
| -import 'dart:math';
|
| -''');
|
| - }
|
| -
|
| - void test_true_import_prefix() {
|
| - _assertMatches(
|
| - r'''
|
| -import 'dart:async' as async;
|
| -''',
|
| - r'''
|
| -import 'dart:async' as async;
|
| -''');
|
| - }
|
| -
|
| - void test_true_import_show_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -import 'dart:async' show Future, Stream;
|
| -''',
|
| - r'''
|
| -import 'dart:async' show Stream, Future;
|
| -''');
|
| - }
|
| -
|
| - void test_true_method_annotation_accessor_same() {
|
| - _assertMatches(
|
| - r'''
|
| -const my_annotation = const Object();
|
| -class A {
|
| - @my_annotation
|
| - void m() {}
|
| -}
|
| -''',
|
| - r'''
|
| -const my_annotation = const Object();
|
| -class A {
|
| - @my_annotation
|
| - void m() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_method_annotation_constructor_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class MyAnnotation {
|
| - const MyAnnotation();
|
| -}
|
| -class A {
|
| - @MyAnnotation()
|
| - void m() {}
|
| -}
|
| -''',
|
| - r'''
|
| -class MyAnnotation {
|
| - const MyAnnotation();
|
| -}
|
| -class A {
|
| - @MyAnnotation()
|
| - void m() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_method_async() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - m() async {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - m() async {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_method_list_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - a() {}
|
| - b() {}
|
| - c() {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - c() {}
|
| - a() {}
|
| - b() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_method_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - a() {}
|
| - b() {}
|
| - c() {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - a() {}
|
| - b() {}
|
| - c() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_method_operator_minus() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - operator -(other) {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - operator -(other) {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_method_operator_minusUnary() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - operator -() {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - operator -() {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_method_operator_plus() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - operator +(other) {}
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - operator +(other) {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_method_parameters_type_functionType() {
|
| - _assertMatches(
|
| - r'''
|
| -typedef F();
|
| -class A {
|
| - m(F p) {}
|
| -}
|
| -''',
|
| - r'''
|
| -typedef F();
|
| -class A {
|
| - m(F p) {}
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_method_parameters_type_sameImportPrefix() {
|
| - _assertMatches(
|
| - r'''
|
| -import 'dart:async' as a;
|
| -
|
| -bar(a.Future f) {
|
| - print(f);
|
| -}
|
| -''',
|
| - r'''
|
| -import 'dart:async' as a;
|
| -
|
| -bar(a.Future ff) {
|
| - print(ff);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_part_list_reorder() {
|
| - addNamedSource('/unitA.dart', 'part of lib; class A {}');
|
| - addNamedSource('/unitB.dart', 'part of lib; class B {}');
|
| - _assertMatches(
|
| - r'''
|
| -library lib;
|
| -part 'unitA.dart';
|
| -part 'unitB.dart';
|
| -''',
|
| - r'''
|
| -library lib;
|
| -part 'unitB.dart';
|
| -part 'unitA.dart';
|
| -''');
|
| - }
|
| -
|
| - void test_true_part_list_same() {
|
| - addNamedSource('/unitA.dart', 'part of lib; class A {}');
|
| - addNamedSource('/unitB.dart', 'part of lib; class B {}');
|
| - _assertMatches(
|
| - r'''
|
| -library lib;
|
| -part 'unitA.dart';
|
| -part 'unitB.dart';
|
| -''',
|
| - r'''
|
| -library lib;
|
| -part 'unitA.dart';
|
| -part 'unitB.dart';
|
| -''');
|
| - }
|
| -
|
| - void test_true_SimpleFormalParameter_optional_differentName() {
|
| - _assertMatches(
|
| - r'''
|
| -main([int oldName]) {
|
| -}
|
| -''',
|
| - r'''
|
| -main([int newName]) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_SimpleFormalParameter_optionalDefault_differentName() {
|
| - _assertMatches(
|
| - r'''
|
| -main([int oldName = 1]) {
|
| -}
|
| -''',
|
| - r'''
|
| -main([int newName = 1]) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_SimpleFormalParameter_required_differentName() {
|
| - _assertMatches(
|
| - r'''
|
| -main(int oldName) {
|
| -}
|
| -''',
|
| - r'''
|
| -main(int newName) {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_topLevelAccessor_list_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -set a(x) {}
|
| -set b(x) {}
|
| -set c(x) {}
|
| -''',
|
| - r'''
|
| -set c(x) {}
|
| -set a(x) {}
|
| -set b(x) {}
|
| -''');
|
| - }
|
| -
|
| - void test_true_topLevelAccessor_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -get a => 1;
|
| -get b => 2;
|
| -get c => 3;
|
| -''',
|
| - r'''
|
| -get a => 1;
|
| -get b => 2;
|
| -get c => 3;
|
| -''');
|
| - }
|
| -
|
| - void test_true_topLevelFunction_list_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -a() {}
|
| -b() {}
|
| -c() {}
|
| -''',
|
| - r'''
|
| -c() {}
|
| -a() {}
|
| -b() {}
|
| -''');
|
| - }
|
| -
|
| - void test_true_topLevelFunction_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -a() {}
|
| -b() {}
|
| -c() {}
|
| -''',
|
| - r'''
|
| -a() {}
|
| -b() {}
|
| -c() {}
|
| -''');
|
| - }
|
| -
|
| - void test_true_topLevelVariable_list_reorder() {
|
| - _assertMatches(
|
| - r'''
|
| -const int A = 1;
|
| -const int B = 2;
|
| -const int C = 3;
|
| -''',
|
| - r'''
|
| -const int C = 3;
|
| -const int A = 1;
|
| -const int B = 2;
|
| -''');
|
| - }
|
| -
|
| - void test_true_topLevelVariable_list_same() {
|
| - _assertMatches(
|
| - r'''
|
| -const int A = 1;
|
| -const int B = 2;
|
| -const int C = 3;
|
| -''',
|
| - r'''
|
| -const int A = 1;
|
| -const int B = 2;
|
| -const int C = 3;
|
| -''');
|
| - }
|
| -
|
| - void test_true_topLevelVariable_type_sameArgs() {
|
| - _assertMatches(
|
| - r'''
|
| -Map<int, String> A;
|
| -''',
|
| - r'''
|
| -Map<int, String> A;
|
| -''');
|
| - }
|
| -
|
| - void test_true_type_dynamic() {
|
| - _assertMatches(
|
| - r'''
|
| -dynamic a() {}
|
| -''',
|
| - r'''
|
| -dynamic a() {}
|
| -''');
|
| - }
|
| -
|
| - void test_true_type_hasImportPrefix() {
|
| - _assertMatches(
|
| - r'''
|
| -import 'dart:async' as async;
|
| -async.Future F;
|
| -''',
|
| - r'''
|
| -import 'dart:async' as async;
|
| -async.Future F;
|
| -''');
|
| - }
|
| -
|
| - void test_true_type_noTypeArguments_implyAllDynamic() {
|
| - _assertMatches(
|
| - r'''
|
| -class A<T> {}
|
| -A main() {
|
| -}
|
| -''',
|
| - r'''
|
| -class A<T> {}
|
| -A main() {
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_type_void() {
|
| - _assertMatches(
|
| - r'''
|
| -void a() {}
|
| -''',
|
| - r'''
|
| -void a() {}
|
| -''');
|
| - }
|
| -
|
| - void test_true_withClause_same() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {}
|
| -class B extends Object with A {}
|
| -''',
|
| - r'''
|
| -class A {}
|
| -class B extends Object with A {}
|
| -''');
|
| - }
|
| -
|
| - void _assertDoesNotMatch(String oldContent, String newContent) {
|
| - _assertMatchKind(DeclarationMatchKind.MISMATCH, oldContent, newContent);
|
| - }
|
| -
|
| - void _assertDoesNotMatchOK(String oldContent, String newContent) {
|
| - _assertMatchKind(DeclarationMatchKind.MISMATCH_OK, oldContent, newContent);
|
| - }
|
| -
|
| - void _assertMatches(String oldContent, String newContent) {
|
| - _assertMatchKind(DeclarationMatchKind.MATCH, oldContent, newContent);
|
| - }
|
| -
|
| - void _assertMatchKind(
|
| - DeclarationMatchKind expectMatch, String oldContent, String newContent) {
|
| - Source source = addSource(oldContent);
|
| - LibraryElement library = resolve2(source);
|
| - CompilationUnit oldUnit = resolveCompilationUnit(source, library);
|
| - // parse
|
| - CompilationUnit newUnit = IncrementalResolverTest._parseUnit(newContent);
|
| - // build elements
|
| - {
|
| - ElementHolder holder = new ElementHolder();
|
| - ElementBuilder builder = new ElementBuilder(holder, oldUnit.element);
|
| - newUnit.accept(builder);
|
| - }
|
| - // match
|
| - DeclarationMatcher matcher = new DeclarationMatcher();
|
| - DeclarationMatchKind matchKind = matcher.matches(newUnit, oldUnit.element);
|
| - expect(matchKind, same(expectMatch));
|
| - }
|
| -}
|
| -
|
| -@reflectiveTest
|
| class IncrementalResolverTest extends ResolverTestCase {
|
| Source source;
|
| String code;
|
| @@ -3166,26 +194,6 @@ class A {
|
| _resolve(_editString('+', '*'), _isFunctionBody);
|
| }
|
|
|
| - void test_constructor_fieldInitializer_add() {
|
| - _resolveUnit(r'''
|
| -class A {
|
| - int f;
|
| - A(int a, int b);
|
| -}''');
|
| - _resolve(_editString(');', ') : f = a + b;'), _isClassMember);
|
| - }
|
| -
|
| - void test_constructor_fieldInitializer_edit() {
|
| - _resolveUnit(r'''
|
| -class A {
|
| - int f;
|
| - A(int a, int b) : f = a + b {
|
| - int a = 42;
|
| - }
|
| -}''');
|
| - _resolve(_editString('+', '*'), _isExpression);
|
| - }
|
| -
|
| void test_constructor_label_add() {
|
| _resolveUnit(r'''
|
| class A {
|
| @@ -3208,18 +216,6 @@ class A {
|
| _resolve(_editString('42;', 'var res = 42;'), _isBlock);
|
| }
|
|
|
| - void test_constructor_superConstructorInvocation() {
|
| - _resolveUnit(r'''
|
| -class A {
|
| - A(int p);
|
| -}
|
| -class B extends A {
|
| - B(int a, int b) : super(a + b);
|
| -}
|
| -''');
|
| - _resolve(_editString('+', '*'), _isExpression);
|
| - }
|
| -
|
| void test_function_localFunction_add() {
|
| _resolveUnit(r'''
|
| int main() {
|
| @@ -3238,13 +234,6 @@ main(int a, int b) {
|
| _resolve(_editString('+', '*'), _isFunctionBody);
|
| }
|
|
|
| - void test_functionBody_expression() {
|
| - _resolveUnit(r'''
|
| -main(int a, int b) => a + b;
|
| -''');
|
| - _resolve(_editString('+', '*'), _isExpression);
|
| - }
|
| -
|
| void test_functionBody_statement() {
|
| _resolveUnit(r'''
|
| main(int a, int b) {
|
| @@ -3304,23 +293,6 @@ class A {
|
| _isBlock);
|
| }
|
|
|
| - void test_method_parameter_rename() {
|
| - _resolveUnit(r'''
|
| -class A {
|
| - int m(int a, int b, int c) {
|
| - return a + b + c;
|
| - }
|
| -}
|
| -''');
|
| - _resolve(
|
| - _editString(
|
| - r'''(int a, int b, int c) {
|
| - return a + b + c;''',
|
| - r'''(int a, int second, int c) {
|
| - return a + second + c;'''),
|
| - _isDeclaration);
|
| - }
|
| -
|
| void test_superInvocation() {
|
| _resolveUnit(r'''
|
| class A {
|
| @@ -3386,36 +358,6 @@ int main(int a, int b) {
|
| _resolve(_editString('int res = a * b;', ''), _isBlock);
|
| }
|
|
|
| - void test_topLevelFunction_parameter_inFunctionTyped_rename() {
|
| - _resolveUnit(r'''
|
| -test(f(int a, int b)) {
|
| -}
|
| -''');
|
| - _resolve(_editString('test(f(int a', 'test(f2(int a2'), _isDeclaration);
|
| - }
|
| -
|
| - void test_topLevelFunction_parameter_rename() {
|
| - _resolveUnit(r'''
|
| -int main(int a, int b) {
|
| - return a + b;
|
| -}
|
| -''');
|
| - _resolve(
|
| - _editString(
|
| - r'''(int a, int b) {
|
| - return a + b;''',
|
| - r'''(int first, int b) {
|
| - return first + b;'''),
|
| - _isDeclaration);
|
| - }
|
| -
|
| - void test_topLevelVariable_initializer() {
|
| - _resolveUnit(r'''
|
| -int C = 1 + 2;
|
| -''');
|
| - _resolve(_editString('+', '*'), _isExpression);
|
| - }
|
| -
|
| void test_updateElementOffset() {
|
| _resolveUnit(r'''
|
| class A {
|
| @@ -3487,7 +429,11 @@ class B {
|
| LibrarySpecificUnit lsu = new LibrarySpecificUnit(source, source);
|
| resolver = new IncrementalResolver(cache, cache.get(source), cache.get(lsu),
|
| unit.element, updateOffset, updateEndOld, updateOldNew);
|
| - bool success = resolver.resolve(newNode);
|
| +
|
| + BlockFunctionBody body = newNode.getAncestor((n) => n is BlockFunctionBody);
|
| + expect(body, isNotNull);
|
| +
|
| + bool success = resolver.resolve(body);
|
| expect(success, isTrue);
|
| _checkCacheEntries(cache);
|
|
|
| @@ -3536,12 +482,6 @@ class B {
|
|
|
| static bool _isBlock(AstNode node) => node is Block;
|
|
|
| - static bool _isClassMember(AstNode node) => node is ClassMember;
|
| -
|
| - static bool _isDeclaration(AstNode node) => node is Declaration;
|
| -
|
| - static bool _isExpression(AstNode node) => node is Expression;
|
| -
|
| static bool _isFunctionBody(AstNode node) => node is FunctionBody;
|
|
|
| static bool _isStatement(AstNode node) => node is Statement;
|
| @@ -4177,6 +1117,59 @@ class A {
|
| expectedSuccess: false);
|
| }
|
|
|
| + void test_false_wholeConstructor_addInitializer() {
|
| + _resolveUnit(r'''
|
| +class A {
|
| + int field;
|
| + A();
|
| +}
|
| +''');
|
| + _updateAndValidate(
|
| + r'''
|
| +class A {
|
| + int field;
|
| + A() : field = 5;
|
| +}
|
| +''',
|
| + expectedSuccess: false);
|
| + }
|
| +
|
| + void test_false_wholeFunction() {
|
| + _resolveUnit(r'''
|
| +foo() {}
|
| +main(int a) {
|
| + print(a);
|
| +}
|
| +''');
|
| + _updateAndValidate(
|
| + r'''
|
| +foo() {}
|
| +main(int b) {
|
| + print(b);
|
| +}
|
| +''',
|
| + expectedSuccess: false);
|
| + }
|
| +
|
| + void test_false_wholeMethod() {
|
| + _resolveUnit(r'''
|
| +class A {
|
| + main(int a) {
|
| + print(a);
|
| + }
|
| +}
|
| +''');
|
| + _updateAndValidate(
|
| + r'''
|
| +class A {
|
| + main(int b) {
|
| + print(b);
|
| + }
|
| +}
|
| +''',
|
| + expectedSuccess: false);
|
| + }
|
| +
|
| void test_fieldClassField_propagatedType() {
|
| _resolveUnit(r'''
|
| class A {
|
| @@ -4414,66 +1407,6 @@ foo() {
|
| _assertEqualErrors(newErrors, oldErrors);
|
| }
|
|
|
| - void test_true_wholeConstructor_addInitializer() {
|
| - _resolveUnit(r'''
|
| -class A {
|
| - int field;
|
| - A();
|
| -}
|
| -''');
|
| - _updateAndValidate(r'''
|
| -class A {
|
| - int field;
|
| - A() : field = 5;
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_wholeFunction() {
|
| - _resolveUnit(r'''
|
| -foo() {}
|
| -main(int a) {
|
| - print(a);
|
| -}
|
| -''');
|
| - _updateAndValidate(r'''
|
| -foo() {}
|
| -main(int b) {
|
| - print(b);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_wholeFunction_firstTokenInUnit() {
|
| - _resolveUnit(r'''
|
| -main(int a) {
|
| - print(a);
|
| -}
|
| -''');
|
| - _updateAndValidate(r'''
|
| -main(int b) {
|
| - print(b);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - void test_true_wholeMethod() {
|
| - _resolveUnit(r'''
|
| -class A {
|
| - main(int a) {
|
| - print(a);
|
| - }
|
| -}
|
| -''');
|
| - _updateAndValidate(r'''
|
| -class A {
|
| - main(int b) {
|
| - print(b);
|
| - }
|
| -}
|
| -''');
|
| - }
|
| -
|
| void test_unusedHint_add_wasUsedOnlyInPart() {
|
| Source partSource = addNamedSource(
|
| '/my_unit.dart',
|
|
|