mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
Respect the "allowErrors" parameter in _ResynthesizeAstTest.checkLibrary.
R=scheglov@google.com Review URL: https://codereview.chromium.org/2527453002 .
This commit is contained in:
parent
9bc4c73e2d
commit
679e8fd9ff
|
@ -6,6 +6,7 @@ library analyzer.test.src.summary.resynthesize_ast_test;
|
|||
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/src/dart/element/element.dart';
|
||||
import 'package:analyzer/src/generated/engine.dart'
|
||||
show AnalysisContext, AnalysisOptionsImpl;
|
||||
|
@ -881,6 +882,12 @@ abstract class _ResynthesizeAstTest extends ResynthesizeTest
|
|||
Source source = addTestSource(text);
|
||||
LibraryElementImpl resynthesized = _encodeDecodeLibraryElement(source);
|
||||
LibraryElementImpl original = context.computeLibraryElement(source);
|
||||
if (!allowErrors) {
|
||||
List<AnalysisError> errors = context.computeErrors(source);
|
||||
if (errors.where((e) => e.message.startsWith('unused')).isNotEmpty) {
|
||||
fail('Analysis errors: $errors');
|
||||
}
|
||||
}
|
||||
checkLibraryElements(original, resynthesized);
|
||||
return resynthesized;
|
||||
}
|
||||
|
|
|
@ -4540,47 +4540,51 @@ typedef F();''');
|
|||
}
|
||||
|
||||
test_unresolved_annotation_namedConstructorCall_noClass() {
|
||||
checkLibrary('@foo.bar() class C {}');
|
||||
checkLibrary('@foo.bar() class C {}', allowErrors: true);
|
||||
}
|
||||
|
||||
test_unresolved_annotation_namedConstructorCall_noConstructor() {
|
||||
checkLibrary('@String.foo() class C {}');
|
||||
checkLibrary('@String.foo() class C {}', allowErrors: true);
|
||||
}
|
||||
|
||||
test_unresolved_annotation_prefixedIdentifier_badPrefix() {
|
||||
checkLibrary('@foo.bar class C {}');
|
||||
checkLibrary('@foo.bar class C {}', allowErrors: true);
|
||||
}
|
||||
|
||||
test_unresolved_annotation_prefixedIdentifier_noDeclaration() {
|
||||
checkLibrary('import "dart:async" as foo; @foo.bar class C {}');
|
||||
checkLibrary('import "dart:async" as foo; @foo.bar class C {}',
|
||||
allowErrors: true);
|
||||
}
|
||||
|
||||
test_unresolved_annotation_prefixedNamedConstructorCall_badPrefix() {
|
||||
checkLibrary('@foo.bar.baz() class C {}');
|
||||
checkLibrary('@foo.bar.baz() class C {}', allowErrors: true);
|
||||
}
|
||||
|
||||
test_unresolved_annotation_prefixedNamedConstructorCall_noClass() {
|
||||
checkLibrary('import "dart:async" as foo; @foo.bar.baz() class C {}');
|
||||
checkLibrary('import "dart:async" as foo; @foo.bar.baz() class C {}',
|
||||
allowErrors: true);
|
||||
}
|
||||
|
||||
test_unresolved_annotation_prefixedNamedConstructorCall_noConstructor() {
|
||||
checkLibrary('import "dart:async" as foo; @foo.Future.bar() class C {}');
|
||||
checkLibrary('import "dart:async" as foo; @foo.Future.bar() class C {}',
|
||||
allowErrors: true);
|
||||
}
|
||||
|
||||
test_unresolved_annotation_prefixedUnnamedConstructorCall_badPrefix() {
|
||||
checkLibrary('@foo.bar() class C {}');
|
||||
checkLibrary('@foo.bar() class C {}', allowErrors: true);
|
||||
}
|
||||
|
||||
test_unresolved_annotation_prefixedUnnamedConstructorCall_noClass() {
|
||||
checkLibrary('import "dart:async" as foo; @foo.bar() class C {}');
|
||||
checkLibrary('import "dart:async" as foo; @foo.bar() class C {}',
|
||||
allowErrors: true);
|
||||
}
|
||||
|
||||
test_unresolved_annotation_simpleIdentifier() {
|
||||
checkLibrary('@foo class C {}');
|
||||
checkLibrary('@foo class C {}', allowErrors: true);
|
||||
}
|
||||
|
||||
test_unresolved_annotation_unnamedConstructorCall_noClass() {
|
||||
checkLibrary('@foo() class C {}');
|
||||
checkLibrary('@foo() class C {}', allowErrors: true);
|
||||
}
|
||||
|
||||
test_unresolved_export() {
|
||||
|
|
Loading…
Reference in a new issue