| Index: packages/analyzer/test/generated/incremental_resolver_test.dart
|
| diff --git a/packages/analyzer/test/generated/incremental_resolver_test.dart b/packages/analyzer/test/generated/incremental_resolver_test.dart
|
| index eaef1654096c5abf7885ace7545f039c8b4dc6f2..e14edd333427529ecfe0f3fa8d6d87f17e564856 100644
|
| --- a/packages/analyzer/test/generated/incremental_resolver_test.dart
|
| +++ b/packages/analyzer/test/generated/incremental_resolver_test.dart
|
| @@ -2,3091 +2,187 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -library engine.incremental_resolver_test;
|
| -
|
| -import 'package:analyzer/src/context/cache.dart' as task;
|
| -import 'package:analyzer/src/generated/ast.dart';
|
| -import 'package:analyzer/src/generated/element.dart';
|
| +library analyzer.test.generated.incremental_resolver_test;
|
| +
|
| +import 'package:analyzer/dart/ast/ast.dart';
|
| +import 'package:analyzer/dart/ast/token.dart';
|
| +import 'package:analyzer/dart/element/element.dart';
|
| +import 'package:analyzer/error/error.dart';
|
| +import 'package:analyzer/error/listener.dart';
|
| +import 'package:analyzer/exception/exception.dart';
|
| +import 'package:analyzer/src/context/cache.dart';
|
| +import 'package:analyzer/src/dart/ast/utilities.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';
|
| import 'package:analyzer/src/generated/engine.dart';
|
| -import 'package:analyzer/src/generated/error.dart';
|
| -import 'package:analyzer/src/generated/incremental_logger.dart' as log;
|
| +import 'package:analyzer/src/generated/incremental_logger.dart' as logging;
|
| import 'package:analyzer/src/generated/incremental_resolution_validator.dart';
|
| import 'package:analyzer/src/generated/incremental_resolver.dart';
|
| import 'package:analyzer/src/generated/java_engine.dart';
|
| import 'package:analyzer/src/generated/parser.dart';
|
| import 'package:analyzer/src/generated/resolver.dart';
|
| -import 'package:analyzer/src/generated/scanner.dart';
|
| import 'package:analyzer/src/generated/source_io.dart';
|
| import 'package:analyzer/src/generated/testing/ast_factory.dart';
|
| import 'package:analyzer/src/generated/testing/element_factory.dart';
|
| +import 'package:analyzer/src/generated/utilities_collection.dart';
|
| +import 'package:analyzer/src/task/dart.dart';
|
| import 'package:analyzer/task/dart.dart';
|
| +import 'package:analyzer/task/model.dart';
|
| +import 'package:test_reflective_loader/test_reflective_loader.dart';
|
| import 'package:unittest/unittest.dart';
|
|
|
| -import '../reflective_tests.dart';
|
| -import 'parser_test.dart';
|
| -import 'resolver_test.dart';
|
| +import 'analysis_context_factory.dart';
|
| +import 'resolver_test_case.dart';
|
| import 'test_support.dart';
|
|
|
| main() {
|
| initializeTestEnvironment();
|
| - runReflectiveTests(DeclarationMatcherTest);
|
| - runReflectiveTests(IncrementalResolverTest);
|
| - runReflectiveTests(PoorMansIncrementalResolutionTest);
|
| - runReflectiveTests(ResolutionContextBuilderTest);
|
| + defineReflectiveTests(IncrementalResolverTest);
|
| + defineReflectiveTests(PoorMansIncrementalResolutionTest);
|
| + defineReflectiveTests(ResolutionContextBuilderTest);
|
| }
|
|
|
| void initializeTestEnvironment() {}
|
|
|
| -void _assertEqualError(AnalysisError incrError, AnalysisError fullError) {
|
| - if (incrError.errorCode != fullError.errorCode ||
|
| - incrError.source != fullError.source ||
|
| - incrError.offset != fullError.offset ||
|
| - incrError.length != fullError.length ||
|
| - incrError.message != fullError.message) {
|
| +void _assertEqualError(AnalysisError incError, AnalysisError fullError) {
|
| + if (incError.errorCode != fullError.errorCode ||
|
| + incError.source != fullError.source ||
|
| + incError.offset != fullError.offset ||
|
| + incError.length != fullError.length ||
|
| + incError.message != fullError.message) {
|
| StringBuffer buffer = new StringBuffer();
|
| buffer.writeln('Found error does not match expected error:');
|
| - if (incrError.errorCode == fullError.errorCode) {
|
| + if (incError.errorCode == fullError.errorCode) {
|
| buffer.write(' errorCode = ');
|
| buffer.write(fullError.errorCode.uniqueName);
|
| } else {
|
| buffer.write(' Expected errorCode = ');
|
| buffer.write(fullError.errorCode.uniqueName);
|
| buffer.write(' found ');
|
| - buffer.write(incrError.errorCode.uniqueName);
|
| + buffer.write(incError.errorCode.uniqueName);
|
| }
|
| buffer.writeln();
|
| - if (incrError.source == fullError.source) {
|
| + if (incError.source == fullError.source) {
|
| buffer.write(' source = ');
|
| buffer.write(fullError.source);
|
| } else {
|
| buffer.write(' Expected source = ');
|
| buffer.write(fullError.source);
|
| buffer.write(' found ');
|
| - buffer.write(incrError.source);
|
| + buffer.write(incError.source);
|
| }
|
| buffer.writeln();
|
| - if (incrError.offset == fullError.offset) {
|
| + if (incError.offset == fullError.offset) {
|
| buffer.write(' offset = ');
|
| buffer.write(fullError.offset);
|
| } else {
|
| buffer.write(' Expected offset = ');
|
| buffer.write(fullError.offset);
|
| buffer.write(' found ');
|
| - buffer.write(incrError.offset);
|
| + buffer.write(incError.offset);
|
| }
|
| buffer.writeln();
|
| - if (incrError.length == fullError.length) {
|
| + if (incError.length == fullError.length) {
|
| buffer.write(' length = ');
|
| buffer.write(fullError.length);
|
| } else {
|
| buffer.write(' Expected length = ');
|
| buffer.write(fullError.length);
|
| buffer.write(' found ');
|
| - buffer.write(incrError.length);
|
| + buffer.write(incError.length);
|
| }
|
| buffer.writeln();
|
| - if (incrError.message == fullError.message) {
|
| + if (incError.message == fullError.message) {
|
| buffer.write(' message = ');
|
| buffer.write(fullError.message);
|
| } else {
|
| buffer.write(' Expected message = ');
|
| buffer.write(fullError.message);
|
| buffer.write(' found ');
|
| - buffer.write(incrError.message);
|
| + buffer.write(incError.message);
|
| }
|
| fail(buffer.toString());
|
| }
|
| }
|
|
|
| void _assertEqualErrors(
|
| - List<AnalysisError> incrErrors, List<AnalysisError> fullErrors) {
|
| - expect(incrErrors, hasLength(fullErrors.length));
|
| - if (incrErrors.isNotEmpty) {
|
| - incrErrors.sort((a, b) => a.offset - b.offset);
|
| + List<AnalysisError> incErrors, List<AnalysisError> fullErrors) {
|
| + expect(incErrors, hasLength(fullErrors.length));
|
| + if (incErrors.isNotEmpty) {
|
| + incErrors.sort((a, b) => a.offset - b.offset);
|
| }
|
| if (fullErrors.isNotEmpty) {
|
| fullErrors.sort((a, b) => a.offset - b.offset);
|
| }
|
| - int length = incrErrors.length;
|
| + int length = incErrors.length;
|
| for (int i = 0; i < length; i++) {
|
| - AnalysisError incrError = incrErrors[i];
|
| + AnalysisError incError = incErrors[i];
|
| AnalysisError fullError = fullErrors[i];
|
| - _assertEqualError(incrError, fullError);
|
| - }
|
| -}
|
| -
|
| -@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();
|
| + _assertEqualError(incError, fullError);
|
| }
|
| }
|
| -''');
|
| - }
|
|
|
| - 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 _checkCacheEntries(AnalysisCache cache) {
|
| + Set seen = new Set();
|
| + MapIterator<AnalysisTarget, CacheEntry> it = cache.iterator();
|
| + while (it.moveNext()) {
|
| + AnalysisTarget key = it.key;
|
| + if (cache.get(key) == null) {
|
| + fail("cache corrupted: value of $key changed to null");
|
| + }
|
| + if (!seen.add(key)) {
|
| + fail("cache corrupted: $key appears more than once");
|
| + }
|
| }
|
| }
|
| -''');
|
| - }
|
|
|
| - void test_false_constructor_parameters_list_add() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - A();
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A(int p);
|
| -}
|
| -''');
|
| - }
|
| +@reflectiveTest
|
| +class IncrementalResolverTest extends ResolverTestCase {
|
| + Source source;
|
| + String code;
|
| + LibraryElement library;
|
| + CompilationUnit unit;
|
|
|
| - void test_false_constructor_parameters_list_remove() {
|
| - _assertDoesNotMatch(
|
| - r'''
|
| -class A {
|
| - A(int p);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - A();
|
| -}
|
| -''');
|
| + void setUp() {
|
| + super.setUp();
|
| + logging.logger = logging.NULL_LOGGER;
|
| }
|
|
|
| - 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_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_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_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_changeName_wasUnresolvedField() {
|
| - _assertMatches(
|
| - r'''
|
| -class A {
|
| - final fff;
|
| - A(this.unresolved);
|
| -}
|
| -''',
|
| - r'''
|
| -class A {
|
| - final fff;
|
| - A(this.fff);
|
| -}
|
| -''');
|
| - }
|
| -
|
| - 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 = ParserTestCase.parseCompilationUnit(newContent);
|
| - // build elements
|
| - {
|
| - ElementHolder holder = new ElementHolder();
|
| - ElementBuilder builder = new ElementBuilder(holder);
|
| - 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;
|
| - LibraryElement library;
|
| - CompilationUnit unit;
|
| -
|
| - @override
|
| - void reset() {
|
| - if (AnalysisEngine.instance.useTaskModel) {
|
| - analysisContext2 = AnalysisContextFactory.contextWithCore();
|
| - } else {
|
| - analysisContext2 = AnalysisContextFactory.oldContextWithCore();
|
| - }
|
| - }
|
| -
|
| - @override
|
| - void resetWithOptions(AnalysisOptions options) {
|
| - if (AnalysisEngine.instance.useTaskModel) {
|
| - analysisContext2 =
|
| - AnalysisContextFactory.contextWithCoreAndOptions(options);
|
| - } else {
|
| - analysisContext2 =
|
| - AnalysisContextFactory.oldContextWithCoreAndOptions(options);
|
| - }
|
| - }
|
| -
|
| - void setUp() {
|
| - super.setUp();
|
| - test_resolveApiChanges = true;
|
| - log.logger = log.NULL_LOGGER;
|
| - }
|
| -
|
| - void test_classMemberAccessor_body() {
|
| - _resolveUnit(r'''
|
| -class A {
|
| - int get test {
|
| - return 1 + 2;
|
| - }
|
| -}''');
|
| - _resolve(_editString('+', '*'), _isFunctionBody);
|
| - }
|
| -
|
| - void test_constructor_body() {
|
| + void test_classMemberAccessor_body() {
|
| _resolveUnit(r'''
|
| class A {
|
| - int f;
|
| - A(int a, int b) {
|
| - f = a + b;
|
| + int get test {
|
| + return 1 + 2;
|
| }
|
| }''');
|
| _resolve(_editString('+', '*'), _isFunctionBody);
|
| }
|
|
|
| - void test_constructor_fieldInitializer_add() {
|
| + void test_computeConstants_offsetChanged() {
|
| _resolveUnit(r'''
|
| -class A {
|
| - int f;
|
| - A(int a, int b);
|
| -}''');
|
| - _resolve(_editString(');', ') : f = a + b;'), _isClassMember);
|
| +int f() => 0;
|
| +main() {
|
| + const x1 = f();
|
| + const x2 = f();
|
| + const x3 = f();
|
| + const x4 = f();
|
| + const x5 = f();
|
| + print(x1 + x2 + x3 + x4 + x5 + 1);
|
| +}
|
| +''');
|
| + _resolve(_editString('x1', ' x1'), _isFunctionBody);
|
| }
|
|
|
| - void test_constructor_fieldInitializer_edit() {
|
| + void test_constructor_body() {
|
| _resolveUnit(r'''
|
| class A {
|
| int f;
|
| - A(int a, int b) : f = a + b {
|
| - int a = 42;
|
| + A(int a, int b) {
|
| + f = a + b;
|
| }
|
| }''');
|
| - _resolve(_editString('+', '*'), _isExpression);
|
| + _resolve(_editString('+', '*'), _isFunctionBody);
|
| }
|
|
|
| void test_constructor_label_add() {
|
| @@ -3111,27 +207,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_fieldFormalParameter() {
|
| - _resolveUnit(r'''
|
| -class A {
|
| - int xy;
|
| - A(this.x);
|
| -}''');
|
| - _resolve(_editString('this.x', 'this.xy'), _isDeclaration);
|
| - }
|
| -
|
| void test_function_localFunction_add() {
|
| _resolveUnit(r'''
|
| int main() {
|
| @@ -3150,13 +225,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) {
|
| @@ -3216,23 +284,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 {
|
| @@ -3298,36 +349,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 {
|
| @@ -3372,6 +393,9 @@ class B {
|
| edit.replacement +
|
| code.substring(offset + edit.length);
|
| CompilationUnit newUnit = _parseUnit(newCode);
|
| + AnalysisCache cache = analysisContext2.analysisCache;
|
| + _checkCacheEntries(cache);
|
| +
|
| // replace the node
|
| AstNode oldNode = _findNodeAt(unit, offset, predicate);
|
| AstNode newNode = _findNodeAt(newUnit, offset, predicate);
|
| @@ -3383,36 +407,26 @@ class B {
|
| {
|
| int delta = edit.replacement.length - edit.length;
|
| _shiftTokens(unit.beginToken, offset, delta);
|
| + Token oldBeginToken = oldNode.beginToken;
|
| + Token oldEndTokenNext = oldNode.endToken.next;
|
| + oldBeginToken.previous.setNext(newNode.beginToken);
|
| + newNode.endToken.setNext(oldEndTokenNext);
|
| }
|
| // do incremental resolution
|
| int updateOffset = edit.offset;
|
| int updateEndOld = updateOffset + edit.length;
|
| int updateOldNew = updateOffset + edit.replacement.length;
|
| IncrementalResolver resolver;
|
| - if (AnalysisEngine.instance.useTaskModel) {
|
| - LibrarySpecificUnit lsu = new LibrarySpecificUnit(source, source);
|
| - task.AnalysisCache cache = analysisContext2.analysisCache;
|
| - resolver = new IncrementalResolver(
|
| - null,
|
| - cache.get(source),
|
| - cache.get(lsu),
|
| - unit.element,
|
| - updateOffset,
|
| - updateEndOld,
|
| - updateOldNew);
|
| - } else {
|
| - resolver = new IncrementalResolver(
|
| - (analysisContext2 as AnalysisContextImpl)
|
| - .getReadableSourceEntryOrNull(source),
|
| - null,
|
| - null,
|
| - unit.element,
|
| - updateOffset,
|
| - updateEndOld,
|
| - updateOldNew);
|
| - }
|
| - bool success = resolver.resolve(newNode);
|
| - expect(success, isTrue);
|
| + LibrarySpecificUnit lsu = new LibrarySpecificUnit(source, source);
|
| + resolver = new IncrementalResolver(cache, cache.get(source), cache.get(lsu),
|
| + unit.element, updateOffset, updateEndOld, updateOldNew);
|
| +
|
| + BlockFunctionBody body = newNode.getAncestor((n) => n is BlockFunctionBody);
|
| + expect(body, isNotNull);
|
| +
|
| + resolver.resolve(body);
|
| + _checkCacheEntries(cache);
|
| +
|
| List<AnalysisError> newErrors = analysisContext.computeErrors(source);
|
| // resolve "newCode" from scratch
|
| CompilationUnit fullNewUnit;
|
| @@ -3422,11 +436,9 @@ class B {
|
| LibraryElement library = resolve2(source);
|
| fullNewUnit = resolveCompilationUnit(source, library);
|
| }
|
| - try {
|
| - assertSameResolution(unit, fullNewUnit);
|
| - } on IncrementalResolutionMismatch catch (mismatch) {
|
| - fail(mismatch.message);
|
| - }
|
| + _checkCacheEntries(cache);
|
| +
|
| + assertSameResolution(unit, fullNewUnit);
|
| // errors
|
| List<AnalysisError> newFullErrors =
|
| analysisContext.getErrors(source).errors;
|
| @@ -3441,6 +453,7 @@ class B {
|
| library = resolve2(source);
|
| unit = resolveCompilationUnit(source, library);
|
| _runTasks();
|
| + _checkCacheEntries(analysisContext2.analysisCache);
|
| }
|
|
|
| void _runTasks() {
|
| @@ -3459,12 +472,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;
|
| @@ -3479,10 +486,13 @@ class B {
|
| }
|
|
|
| static void _shiftTokens(Token token, int afterOffset, int delta) {
|
| - while (token.type != TokenType.EOF) {
|
| - if (token.offset >= afterOffset) {
|
| + while (true) {
|
| + if (token.offset > afterOffset) {
|
| token.applyDelta(delta);
|
| }
|
| + if (token.type == TokenType.EOF) {
|
| + break;
|
| + }
|
| token = token.next;
|
| }
|
| }
|
| @@ -3494,42 +504,34 @@ class B {
|
| */
|
| @reflectiveTest
|
| class PoorMansIncrementalResolutionTest extends ResolverTestCase {
|
| + final _TestLogger logger = new _TestLogger();
|
| +
|
| Source source;
|
| String code;
|
| LibraryElement oldLibrary;
|
| CompilationUnit oldUnit;
|
| CompilationUnitElement oldUnitElement;
|
|
|
| - void fail_updateErrors_removeExisting_duplicateMethodDeclaration() {
|
| - // TODO(scheglov) We fail to remove the second "foo" declaration.
|
| - // So, we still have the same duplicate declaration problem.
|
| - _resolveUnit(r'''
|
| -class A {
|
| - void foo() {}
|
| - void foo() {}
|
| -}
|
| -''');
|
| - _updateAndValidate(r'''
|
| -class A {
|
| - void foo() {}
|
| - void foo2() {}
|
| -}
|
| -''');
|
| + void assertSameReferencedNames(
|
| + ReferencedNames incNames, ReferencedNames fullNames) {
|
| + expectEqualSets(Iterable actual, Iterable expected) {
|
| + expect(actual, unorderedEquals(expected));
|
| + }
|
| +
|
| + expectEqualSets(incNames.names, fullNames.names);
|
| + expectEqualSets(incNames.instantiatedNames, fullNames.instantiatedNames);
|
| + expectEqualSets(incNames.superToSubs.keys, fullNames.superToSubs.keys);
|
| + for (String key in fullNames.superToSubs.keys) {
|
| + expectEqualSets(incNames.superToSubs[key], fullNames.superToSubs[key]);
|
| + }
|
| }
|
|
|
| @override
|
| void setUp() {
|
| - AnalysisEngine.instance.useTaskModel = true;
|
| super.setUp();
|
| _resetWithIncremental(true);
|
| }
|
|
|
| - @override
|
| - void tearDown() {
|
| - super.tearDown();
|
| - AnalysisEngine.instance.useTaskModel = false;
|
| - }
|
| -
|
| void test_computeConstants() {
|
| _resolveUnit(r'''
|
| int f() => 0;
|
| @@ -3538,13 +540,15 @@ main() {
|
| print(x + 1);
|
| }
|
| ''');
|
| - _updateAndValidate(r'''
|
| + _updateAndValidate(
|
| + r'''
|
| int f() => 0;
|
| main() {
|
| const x = f();
|
| print(x + 2);
|
| }
|
| -''');
|
| +''',
|
| + expectCachePostConstantsValid: false);
|
| }
|
|
|
| void test_dartDoc_beforeField() {
|
| @@ -3567,6 +571,22 @@ class A {
|
| ''');
|
| }
|
|
|
| + void test_dartDoc_beforeTopLevelVariable() {
|
| + _resolveUnit(r'''
|
| +/**
|
| + * Variables [V1] and [V2] of type [int].
|
| + */
|
| +int V1, V2;
|
| +''');
|
| + _updateAndValidate(r'''
|
| +/**
|
| + * Variables [V1] and [V2] of type [int].
|
| + * Updated, with a reference to the [String] type.
|
| + */
|
| +int V1, V2;
|
| +''');
|
| + }
|
| +
|
| void test_dartDoc_clumsy_addReference() {
|
| _resolveUnit(r'''
|
| /**
|
| @@ -3778,23 +798,6 @@ main() {
|
| ''');
|
| }
|
|
|
| - void test_endOfLineComment_localFunction_inTopLevelVariable() {
|
| - _resolveUnit(r'''
|
| -typedef int Binary(one, two, three);
|
| -
|
| -int Global = f((a, b, c) {
|
| - return 0; // Some comment
|
| -});
|
| -''');
|
| - _updateAndValidate(r'''
|
| -typedef int Binary(one, two, three);
|
| -
|
| -int Global = f((a, b, c) {
|
| - return 0; // Some comment
|
| -});
|
| -''');
|
| - }
|
| -
|
| void test_endOfLineComment_outBody_add() {
|
| _resolveUnit(r'''
|
| main() {
|
| @@ -3864,6 +867,25 @@ main() {
|
| ''');
|
| }
|
|
|
| + void test_endOfLineComment_toDartDoc() {
|
| + _resolveUnit(r'''
|
| +class A {
|
| + // text
|
| + main() {
|
| + print(42);
|
| + }
|
| +}''');
|
| + _updateAndValidate(
|
| + r'''
|
| +class A {
|
| + /// text
|
| + main() {
|
| + print(42);
|
| + }
|
| +}''',
|
| + expectedSuccess: false);
|
| + }
|
| +
|
| void test_false_constConstructor_initializer() {
|
| _resolveUnit(r'''
|
| class C {
|
| @@ -3889,6 +911,74 @@ main() {
|
| expectedSuccess: false);
|
| }
|
|
|
| + void test_false_constructor_initializer_damage() {
|
| + _resolveUnit(r'''
|
| +class Problem {
|
| + final Map location;
|
| + final String message;
|
| +
|
| + Problem(Map json)
|
| + : location = json["location"],
|
| + message = json["message"];
|
| +}''');
|
| + _updateAndValidate(
|
| + r'''
|
| +class Problem {
|
| + final Map location;
|
| + final String message;
|
| +
|
| + Problem(Map json)
|
| + : location = json["location],
|
| + message = json["message"];
|
| +}''',
|
| + expectedSuccess: false);
|
| + }
|
| +
|
| + void test_false_constructor_initializer_remove() {
|
| + _resolveUnit(r'''
|
| +class Problem {
|
| + final String severity;
|
| + final Map location;
|
| + final String message;
|
| +
|
| + Problem(Map json)
|
| + : severity = json["severity"],
|
| + location = json["location"],
|
| + message = json["message"];
|
| +}''');
|
| + _updateAndValidate(
|
| + r'''
|
| +class Problem {
|
| + final String severity;
|
| + final Map location;
|
| + final String message;
|
| +
|
| + Problem(Map json)
|
| + : severity = json["severity"],
|
| + message = json["message"];
|
| +}''',
|
| + expectedSuccess: false);
|
| + }
|
| +
|
| + void test_false_endOfLineComment_localFunction_inTopLevelVariable() {
|
| + _resolveUnit(r'''
|
| +typedef int Binary(one, two, three);
|
| +
|
| +int Global = f((a, b, c) {
|
| + return 0; // Some comment
|
| +});
|
| +''');
|
| + _updateAndValidate(
|
| + r'''
|
| +typedef int Binary(one, two, three);
|
| +
|
| +int Global = f((a, b, c) {
|
| + return 0; // Some comment
|
| +});
|
| +''',
|
| + expectedSuccess: false);
|
| + }
|
| +
|
| void test_false_expressionBody() {
|
| _resolveUnit(r'''
|
| class A {
|
| @@ -3904,6 +994,44 @@ class A {
|
| expectedSuccess: false);
|
| }
|
|
|
| + void test_false_expressionBody2() {
|
| + _resolveUnit(r'''
|
| +class A {
|
| + int m() => 10 * 10;
|
| +}
|
| +''');
|
| + _updateAndValidate(
|
| + r'''
|
| +class A {
|
| + int m() => 10 * 100;
|
| +}
|
| +''',
|
| + expectedSuccess: false);
|
| + }
|
| +
|
| + void test_false_inBody_functionExpression() {
|
| + _resolveUnit(r'''
|
| +class C extends D {
|
| + static final f = () {
|
| + var x = 0;
|
| + }();
|
| +}
|
| +
|
| +class D {}
|
| +''');
|
| + _updateAndValidate(
|
| + r'''
|
| +class C extends D {
|
| + static final f = () {
|
| + var x = 01;
|
| + }();
|
| +}
|
| +
|
| +class D {}
|
| +''',
|
| + expectedSuccess: false);
|
| + }
|
| +
|
| void test_false_topLevelFunction_name() {
|
| _resolveUnit(r'''
|
| a() {}
|
| @@ -3969,7 +1097,79 @@ class A {
|
| bbb() {
|
| print(0123456789);
|
| }
|
| -}''',
|
| +}''',
|
| + expectedSuccess: false);
|
| + }
|
| +
|
| + void test_false_wholeConstructor() {
|
| + _resolveUnit(r'''
|
| +class A {
|
| + A(int a) {
|
| + print(a);
|
| + }
|
| +}
|
| +''');
|
| + _updateAndValidate(
|
| + r'''
|
| +class A {
|
| + A(int b) {
|
| + print(b);
|
| + }
|
| +}
|
| +''',
|
| + 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);
|
| }
|
|
|
| @@ -4006,6 +1206,21 @@ main() {
|
| ''');
|
| }
|
|
|
| + void test_hasElementAfter_defaultParameter() {
|
| + _resolveUnit(r'''
|
| +main() {
|
| + print(1);
|
| +}
|
| +otherFunction([p = 0]) {}
|
| +''');
|
| + _updateAndValidate(r'''
|
| +main() {
|
| + print(2);
|
| +}
|
| +otherFunction([p = 0]) {}
|
| +''');
|
| + }
|
| +
|
| void test_inBody_expression() {
|
| _resolveUnit(r'''
|
| class A {
|
| @@ -4107,6 +1322,25 @@ main() {
|
| }
|
| }
|
|
|
| + void test_strongMode_typeComments_insertWhitespace() {
|
| + _resolveUnit(r'''
|
| +import 'dart:async';
|
| +
|
| +void fadeIn(int milliseconds) {
|
| + Future<String> f;
|
| + f.then/*<String>*/((e) {print("hello");});
|
| +}
|
| +''');
|
| + _updateAndValidate(r'''
|
| +import 'dart:async';
|
| +
|
| +void fadeIn(int milliseconds) {
|
| + Future<String> f;
|
| + f.then/*<String>*/((e) {print("hello") ;});
|
| +}
|
| +''');
|
| + }
|
| +
|
| void test_true_emptyLine_betweenClassMembers_insert() {
|
| _resolveUnit(r'''
|
| class A {
|
| @@ -4123,6 +1357,24 @@ class A {
|
| ''');
|
| }
|
|
|
| + void test_true_emptyLine_betweenClassMembers_insert_beforeComment() {
|
| + _resolveUnit(r'''
|
| +class A {
|
| + a() {}
|
| + /// BBB
|
| + b() {}
|
| +}
|
| +''');
|
| + _updateAndValidate(r'''
|
| +class A {
|
| + a() {}
|
| +
|
| + /// BBB
|
| + b() {}
|
| +}
|
| +''');
|
| + }
|
| +
|
| void test_true_emptyLine_betweenClassMembers_remove() {
|
| _resolveUnit(r'''
|
| class A {
|
| @@ -4139,19 +1391,53 @@ class A {
|
| ''');
|
| }
|
|
|
| - void test_true_emptyLine_betweenCompilationUnitMembers_insert() {
|
| + void test_true_emptyLine_betweenClassMembers_remove_beforeComment() {
|
| + _resolveUnit(r'''
|
| +class A {
|
| + a() {}
|
| +
|
| + /// BBB
|
| + b() {}
|
| +}
|
| +''');
|
| + _updateAndValidate(r'''
|
| +class A {
|
| + a() {}
|
| + /// BBB
|
| + b() {}
|
| +}
|
| +''');
|
| + }
|
| +
|
| + void test_true_emptyLine_betweenUnitMembers_insert() {
|
| + _resolveUnit(r'''
|
| +a() {}
|
| +b() {}
|
| +''');
|
| + _updateAndValidate(r'''
|
| +a() {}
|
| +
|
| +b() {}
|
| +''');
|
| + }
|
| +
|
| + void test_true_emptyLine_betweenUnitMembers_insert_beforeComment() {
|
| _resolveUnit(r'''
|
| a() {}
|
| +
|
| +// BBB
|
| b() {}
|
| ''');
|
| _updateAndValidate(r'''
|
| a() {}
|
|
|
| +
|
| +// BBB
|
| b() {}
|
| ''');
|
| }
|
|
|
| - void test_true_emptyLine_betweenCompilationUnitMembers_remove() {
|
| + void test_true_emptyLine_betweenUnitMembers_remove() {
|
| _resolveUnit(r'''
|
| a() {
|
| print(1)
|
| @@ -4173,6 +1459,20 @@ foo(String p) {}
|
| ''');
|
| }
|
|
|
| + void test_true_emptyLine_betweenUnitMembers_remove_beforeComment() {
|
| + _resolveUnit(r'''
|
| +a() {}
|
| +
|
| +// BBB
|
| +b() {}
|
| +''');
|
| + _updateAndValidate(r'''
|
| +a() {}
|
| +// BBB
|
| +b() {}
|
| +''');
|
| + }
|
| +
|
| void test_true_todoHint() {
|
| _resolveUnit(r'''
|
| main() {
|
| @@ -4195,83 +1495,6 @@ foo() {
|
| _assertEqualErrors(newErrors, oldErrors);
|
| }
|
|
|
| - void test_true_wholeConstructor() {
|
| - _resolveUnit(r'''
|
| -class A {
|
| - A(int a) {
|
| - print(a);
|
| - }
|
| -}
|
| -''');
|
| - _updateAndValidate(r'''
|
| -class A {
|
| - A(int b) {
|
| - print(b);
|
| - }
|
| -}
|
| -''');
|
| - }
|
| -
|
| - 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',
|
| @@ -4361,6 +1584,21 @@ class A {
|
| expect(errors, isEmpty);
|
| }
|
|
|
| + void test_updateConstantInitializer() {
|
| + _resolveUnit(r'''
|
| +main() {
|
| + const v = const [Unknown];
|
| +}
|
| +''');
|
| + _updateAndValidate(
|
| + r'''
|
| +main() {
|
| + const v = const [Unknown];
|
| +}
|
| +''',
|
| + expectCachePostConstantsValid: false);
|
| + }
|
| +
|
| void test_updateErrors_addNew_hint1() {
|
| _resolveUnit(r'''
|
| int main() {
|
| @@ -4460,6 +1698,45 @@ foo(int p) {}
|
| ''');
|
| }
|
|
|
| + void test_updateErrors_invalidVerifyErrors() {
|
| + _resolveUnit(r'''
|
| +main() {
|
| + foo('aaa');
|
| +}
|
| +main2() {
|
| + foo('bbb');
|
| +}
|
| +foo(int p) {}
|
| +''');
|
| + // Complete analysis, e.g. compute VERIFY_ERRORS.
|
| + _runTasks();
|
| + // Invalidate VERIFY_ERRORS.
|
| + AnalysisCache cache = analysisContext2.analysisCache;
|
| + LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
|
| + CacheEntry cacheEntry = cache.get(target);
|
| + expect(cacheEntry.getValue(VERIFY_ERRORS), hasLength(2));
|
| + cacheEntry.setState(VERIFY_ERRORS, CacheState.INVALID);
|
| + // Perform incremental resolution.
|
| + _resetWithIncremental(true);
|
| + analysisContext2.setContents(
|
| + source,
|
| + r'''
|
| +main() {
|
| + foo(0);
|
| +}
|
| +main2() {
|
| + foo('bbb');
|
| +}
|
| +foo(int p) {}
|
| +''');
|
| + // VERIFY_ERRORS is still invalid.
|
| + expect(cacheEntry.getState(VERIFY_ERRORS), CacheState.INVALID);
|
| + // Continue analysis - run tasks, so recompute VERIFY_ERRORS.
|
| + _runTasks();
|
| + expect(cacheEntry.getState(VERIFY_ERRORS), CacheState.VALID);
|
| + expect(cacheEntry.getValue(VERIFY_ERRORS), hasLength(1));
|
| + }
|
| +
|
| void test_updateErrors_removeExisting_hint() {
|
| _resolveUnit(r'''
|
| int main() {
|
| @@ -4522,6 +1799,75 @@ f3() {
|
| ''');
|
| }
|
|
|
| + void test_updateFunctionToForLoop() {
|
| + _resolveUnit(r'''
|
| +class PlayDrag {
|
| + final List<num> times = new List<num>();
|
| +
|
| + PlayDrag.start() {}
|
| +
|
| + void update(num pos) {
|
| + fo (int i = times.length - 2; i >= 0; i--) {}
|
| + }
|
| +}
|
| +''');
|
| +
|
| + _updateAndValidate(
|
| + r'''
|
| +class PlayDrag {
|
| + final List<num> times = new List<num>();
|
| +
|
| + PlayDrag.start() {}
|
| +
|
| + void update(num pos) {
|
| + for (int i = times.length - 2; i >= 0; i--) {}
|
| + }
|
| +}
|
| +''',
|
| + expectLibraryUnchanged: false);
|
| + }
|
| +
|
| + void test_visibleRange() {
|
| + _resolveUnit(r'''
|
| +class Test {
|
| + method1(p1) {
|
| + var v1;
|
| + f1() {}
|
| + return 1;
|
| + }
|
| + method2(p2) {
|
| + var v2;
|
| + f2() {}
|
| + return 2;
|
| + }
|
| + method3(p3) {
|
| + var v3;
|
| + f3() {}
|
| + return 3;
|
| + }
|
| +}
|
| +''');
|
| + _updateAndValidate(r'''
|
| +class Test {
|
| + method1(p1) {
|
| + var v1;
|
| + f1() {}
|
| + return 1;
|
| + }
|
| + method2(p2) {
|
| + var v2;
|
| + f2() {}
|
| + return 2222;
|
| + }
|
| + method3(p3) {
|
| + var v3;
|
| + f3() {}
|
| + return 3;
|
| + }
|
| +}
|
| +''');
|
| + }
|
| +
|
| void test_whitespace_getElementAt() {
|
| _resolveUnit(r'''
|
| class A {}
|
| @@ -4552,14 +1898,72 @@ class B extends A {}
|
| }
|
| }
|
|
|
| - void _assertEqualLineInfo(LineInfo incrLineInfo, LineInfo fullLineInfo) {
|
| + void _assertCacheResults(
|
| + {bool expectLibraryUnchanged: true,
|
| + bool expectCachePostConstantsValid: true}) {
|
| + _assertCacheSourceResult(TOKEN_STREAM);
|
| + _assertCacheSourceResult(SCAN_ERRORS);
|
| + _assertCacheSourceResult(PARSED_UNIT);
|
| + _assertCacheSourceResult(PARSE_ERRORS);
|
| + if (!expectLibraryUnchanged) {
|
| + return;
|
| + }
|
| + _assertCacheSourceResult(LIBRARY_ELEMENT1);
|
| + _assertCacheSourceResult(LIBRARY_ELEMENT2);
|
| + _assertCacheSourceResult(LIBRARY_ELEMENT3);
|
| + _assertCacheSourceResult(LIBRARY_ELEMENT4);
|
| + _assertCacheSourceResult(LIBRARY_ELEMENT5);
|
| + _assertCacheSourceResult(LIBRARY_ELEMENT6);
|
| + _assertCacheSourceResult(LIBRARY_ELEMENT7);
|
| + _assertCacheSourceResult(LIBRARY_ELEMENT8);
|
| + _assertCacheSourceResult(LIBRARY_ELEMENT9);
|
| + if (expectCachePostConstantsValid) {
|
| + _assertCacheSourceResult(LIBRARY_ELEMENT);
|
| + }
|
| + _assertCacheUnitResult(RESOLVED_UNIT1);
|
| + _assertCacheUnitResult(RESOLVED_UNIT2);
|
| + _assertCacheUnitResult(RESOLVED_UNIT3);
|
| + _assertCacheUnitResult(RESOLVED_UNIT4);
|
| + _assertCacheUnitResult(RESOLVED_UNIT5);
|
| + _assertCacheUnitResult(RESOLVED_UNIT6);
|
| + _assertCacheUnitResult(RESOLVED_UNIT7);
|
| + _assertCacheUnitResult(RESOLVED_UNIT8);
|
| + _assertCacheUnitResult(RESOLVED_UNIT9);
|
| + _assertCacheUnitResult(RESOLVED_UNIT10);
|
| + _assertCacheUnitResult(RESOLVED_UNIT11);
|
| + if (expectCachePostConstantsValid) {
|
| + _assertCacheUnitResult(RESOLVED_UNIT12);
|
| + _assertCacheUnitResult(RESOLVED_UNIT);
|
| + }
|
| + }
|
| +
|
| + /**
|
| + * Assert that the [result] of [source] is not INVALID.
|
| + */
|
| + void _assertCacheSourceResult(ResultDescriptor result) {
|
| + AnalysisCache cache = analysisContext2.analysisCache;
|
| + CacheState state = cache.getState(source, result);
|
| + expect(state, isNot(CacheState.INVALID), reason: result.toString());
|
| + }
|
| +
|
| + /**
|
| + * Assert that the [result] of the defining unit [source] is not INVALID.
|
| + */
|
| + void _assertCacheUnitResult(ResultDescriptor result) {
|
| + AnalysisCache cache = analysisContext2.analysisCache;
|
| + LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
|
| + CacheState state = cache.getState(target, result);
|
| + expect(state, isNot(CacheState.INVALID), reason: result.toString());
|
| + }
|
| +
|
| + void _assertEqualLineInfo(LineInfo incLineInfo, LineInfo fullLineInfo) {
|
| for (int offset = 0; offset < 1000; offset++) {
|
| - LineInfo_Location incrLocation = incrLineInfo.getLocation(offset);
|
| + LineInfo_Location incLocation = incLineInfo.getLocation(offset);
|
| LineInfo_Location fullLocation = fullLineInfo.getLocation(offset);
|
| - if (incrLocation.lineNumber != fullLocation.lineNumber ||
|
| - incrLocation.columnNumber != fullLocation.columnNumber) {
|
| + if (incLocation.lineNumber != fullLocation.lineNumber ||
|
| + incLocation.columnNumber != fullLocation.columnNumber) {
|
| fail('At offset $offset ' +
|
| - '(${incrLocation.lineNumber}, ${incrLocation.columnNumber})' +
|
| + '(${incLocation.lineNumber}, ${incLocation.columnNumber})' +
|
| ' != ' +
|
| '(${fullLocation.lineNumber}, ${fullLocation.columnNumber})');
|
| }
|
| @@ -4572,10 +1976,10 @@ class B extends A {}
|
| */
|
| void _resetWithIncremental(bool enable) {
|
| AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl();
|
| + analysisOptions.strongMode = true;
|
| analysisOptions.incremental = enable;
|
| analysisOptions.incrementalApi = enable;
|
| -// log.logger = log.PRINT_LOGGER;
|
| - log.logger = log.NULL_LOGGER;
|
| + logging.logger = logger;
|
| analysisContext2.analysisOptions = analysisOptions;
|
| }
|
|
|
| @@ -4595,25 +1999,40 @@ class B extends A {}
|
| }
|
|
|
| void _updateAndValidate(String newCode,
|
| - {bool expectedSuccess: true, bool compareWithFull: true}) {
|
| + {bool expectedSuccess: true,
|
| + bool expectLibraryUnchanged: true,
|
| + bool expectCachePostConstantsValid: true,
|
| + bool compareWithFull: true,
|
| + bool runTasksBeforeIncremental: true}) {
|
| // Run any pending tasks tasks.
|
| - _runTasks();
|
| + if (runTasksBeforeIncremental) {
|
| + _runTasks();
|
| + }
|
| // Update the source - currently this may cause incremental resolution.
|
| // Then request the updated resolved unit.
|
| _resetWithIncremental(true);
|
| analysisContext2.setContents(source, newCode);
|
| CompilationUnit newUnit = resolveCompilationUnit(source, oldLibrary);
|
| + logger.expectNoErrors();
|
| List<AnalysisError> newErrors = analysisContext.computeErrors(source);
|
| LineInfo newLineInfo = analysisContext.getLineInfo(source);
|
| + ReferencedNames newReferencedNames =
|
| + analysisContext.getResult(source, REFERENCED_NAMES);
|
| // check for expected failure
|
| if (!expectedSuccess) {
|
| expect(newUnit.element, isNot(same(oldUnitElement)));
|
| return;
|
| }
|
| + // The cache must still have enough results to make the incremental
|
| + // resolution useful.
|
| + _assertCacheResults(
|
| + expectLibraryUnchanged: expectLibraryUnchanged,
|
| + expectCachePostConstantsValid: expectCachePostConstantsValid);
|
| // The existing CompilationUnit[Element] should be updated.
|
| expect(newUnit, same(oldUnit));
|
| expect(newUnit.element, same(oldUnitElement));
|
| - expect(analysisContext.parseCompilationUnit(source), same(oldUnit));
|
| + expect(analysisContext.getResolvedCompilationUnit(source, oldLibrary),
|
| + same(oldUnit));
|
| // The only expected pending task should return the same resolved
|
| // "newUnit", so all clients will get it using the usual way.
|
| AnalysisResult analysisResult = analysisContext.performAnalysisTask();
|
| @@ -4622,6 +2041,7 @@ class B extends A {}
|
| // Resolve "newCode" from scratch.
|
| if (compareWithFull) {
|
| _resetWithIncremental(false);
|
| + changeSource(source, '');
|
| changeSource(source, newCode);
|
| _runTasks();
|
| LibraryElement library = resolve2(source);
|
| @@ -4630,6 +2050,10 @@ class B extends A {}
|
| _assertEqualTokens(newUnit, fullNewUnit);
|
| // Validate LineInfo
|
| _assertEqualLineInfo(newLineInfo, analysisContext.getLineInfo(source));
|
| + // Validate referenced names.
|
| + ReferencedNames fullReferencedNames =
|
| + analysisContext.getResult(source, REFERENCED_NAMES);
|
| + assertSameReferencedNames(newReferencedNames, fullReferencedNames);
|
| // Validate that "incremental" and "full" units have the same resolution.
|
| try {
|
| assertSameResolution(newUnit, fullNewUnit, validateTypes: true);
|
| @@ -4640,39 +2064,40 @@ class B extends A {}
|
| analysisContext.getErrors(source).errors;
|
| _assertEqualErrors(newErrors, newFullErrors);
|
| }
|
| + _checkCacheEntries(analysisContext2.analysisCache);
|
| }
|
|
|
| - static void _assertEqualToken(Token incrToken, Token fullToken) {
|
| -// print('[${incrToken.offset}] |$incrToken| vs. [${fullToken.offset}] |$fullToken|');
|
| - expect(incrToken.type, fullToken.type);
|
| - expect(incrToken.offset, fullToken.offset);
|
| - expect(incrToken.length, fullToken.length);
|
| - expect(incrToken.lexeme, fullToken.lexeme);
|
| + static void _assertEqualToken(Token incToken, Token fullToken) {
|
| +// print('[${incToken.offset}] |$incToken| vs. [${fullToken.offset}] |$fullToken|');
|
| + expect(incToken.type, fullToken.type);
|
| + expect(incToken.offset, fullToken.offset);
|
| + expect(incToken.length, fullToken.length);
|
| + expect(incToken.lexeme, fullToken.lexeme);
|
| }
|
|
|
| static void _assertEqualTokens(
|
| - CompilationUnit incrUnit, CompilationUnit fullUnit) {
|
| - Token incrToken = incrUnit.beginToken;
|
| + CompilationUnit incUnit, CompilationUnit fullUnit) {
|
| + Token incToken = incUnit.beginToken;
|
| Token fullToken = fullUnit.beginToken;
|
| - while (incrToken.type != TokenType.EOF && fullToken.type != TokenType.EOF) {
|
| - _assertEqualToken(incrToken, fullToken);
|
| + while (incToken.type != TokenType.EOF && fullToken.type != TokenType.EOF) {
|
| + _assertEqualToken(incToken, fullToken);
|
| // comments
|
| {
|
| - Token incrComment = incrToken.precedingComments;
|
| + Token incComment = incToken.precedingComments;
|
| Token fullComment = fullToken.precedingComments;
|
| while (true) {
|
| if (fullComment == null) {
|
| - expect(incrComment, isNull);
|
| + expect(incComment, isNull);
|
| break;
|
| }
|
| - expect(incrComment, isNotNull);
|
| - _assertEqualToken(incrComment, fullComment);
|
| - incrComment = incrComment.next;
|
| + expect(incComment, isNotNull);
|
| + _assertEqualToken(incComment, fullComment);
|
| + incComment = incComment.next;
|
| fullComment = fullComment.next;
|
| }
|
| }
|
| // next tokens
|
| - incrToken = incrToken.next;
|
| + incToken = incToken.next;
|
| fullToken = fullToken.next;
|
| }
|
| }
|
| @@ -4680,8 +2105,6 @@ class B extends A {}
|
|
|
| @reflectiveTest
|
| class ResolutionContextBuilderTest extends EngineTestCase {
|
| - GatheringErrorListener listener = new GatheringErrorListener();
|
| -
|
| void test_scopeFor_ClassDeclaration() {
|
| Scope scope = _scopeFor(_createResolvedClassDeclaration());
|
| EngineTestCase.assertInstanceOf(
|
| @@ -4883,7 +2306,7 @@ class ResolutionContextBuilderTest extends EngineTestCase {
|
| }
|
|
|
| Scope _scopeFor(AstNode node) {
|
| - return ResolutionContextBuilder.contextFor(node, listener).scope;
|
| + return ResolutionContextBuilder.contextFor(node).scope;
|
| }
|
| }
|
|
|
| @@ -4893,3 +2316,34 @@ class _Edit {
|
| final String replacement;
|
| _Edit(this.offset, this.length, this.replacement);
|
| }
|
| +
|
| +class _TestLogger implements logging.Logger {
|
| + Object lastException;
|
| + Object lastStackTrace;
|
| +
|
| + @override
|
| + void enter(String name) {}
|
| +
|
| + @override
|
| + void exit() {}
|
| +
|
| + void expectNoErrors() {
|
| + if (lastException != null) {
|
| + fail("logged an exception:\n$lastException\n$lastStackTrace\n");
|
| + }
|
| + }
|
| +
|
| + @override
|
| + void log(Object obj) {}
|
| +
|
| + @override
|
| + void logException(Object exception, [Object stackTrace]) {
|
| + lastException = exception;
|
| + lastStackTrace = stackTrace;
|
| + }
|
| +
|
| + @override
|
| + logging.LoggingTimer startTimer() {
|
| + return new logging.LoggingTimer(this);
|
| + }
|
| +}
|
|
|