mirror of
https://github.com/dart-lang/sdk
synced 2024-10-03 06:21:30 +00:00
Update more Analyzer fasta tests
Change-Id: I1b39eebaf11882bd1524335a7dcbba86f2d26cfb Reviewed-on: https://dart-review.googlesource.com/60362 Commit-Queue: Dan Rubel <danrubel@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
parent
53c2a6f9d5
commit
8f0106e490
|
@ -110,7 +110,7 @@ abstract class ParserAdapter implements Parser {
|
|||
currentToken = fastaParser.parseClassMember(currentToken);
|
||||
ClassDeclaration declaration = astBuilder.classDeclaration;
|
||||
astBuilder.classDeclaration = null;
|
||||
return declaration.members[0];
|
||||
return declaration.members.isNotEmpty ? declaration.members[0] : null;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
|
@ -253,7 +253,7 @@ class ExpressionParserTest_Fasta extends FastaParserTestCase
|
|||
@override
|
||||
@failingTest
|
||||
void test_parseUnaryExpression_decrement_super() {
|
||||
// TODO(brianwilkerson) Does not recover.
|
||||
// TODO(danrubel) Reports a different error and different token stream.
|
||||
// Expected: TokenType:<MINUS>
|
||||
// Actual: TokenType:<MINUS_MINUS>
|
||||
super.test_parseUnaryExpression_decrement_super();
|
||||
|
@ -262,7 +262,7 @@ class ExpressionParserTest_Fasta extends FastaParserTestCase
|
|||
@override
|
||||
@failingTest
|
||||
void test_parseUnaryExpression_decrement_super_withComment() {
|
||||
// TODO(brianwilkerson) Does not recover.
|
||||
// TODO(danrubel) Reports a different error and different token stream.
|
||||
// Expected: TokenType:<MINUS>
|
||||
// Actual: TokenType:<MINUS_MINUS>
|
||||
super.test_parseUnaryExpression_decrement_super_withComment();
|
||||
|
@ -960,13 +960,6 @@ class RecoveryParserTest_Fasta extends FastaParserTestCase
|
|||
]);
|
||||
}
|
||||
|
||||
@override
|
||||
@failingTest
|
||||
void test_missingIdentifier_afterAnnotation() {
|
||||
// TODO(brianwilkerson) reportUnrecoverableErrorWithToken
|
||||
super.test_missingIdentifier_afterAnnotation();
|
||||
}
|
||||
|
||||
@override
|
||||
void test_relationalExpression_missing_LHS_RHS() {
|
||||
parseExpression("is", codes: [
|
||||
|
@ -987,14 +980,7 @@ class RecoveryParserTest_Fasta extends FastaParserTestCase
|
|||
|
||||
@reflectiveTest
|
||||
class SimpleParserTest_Fasta extends FastaParserTestCase
|
||||
with SimpleParserTestMixin {
|
||||
@override
|
||||
@failingTest
|
||||
void test_parseTypeParameterList_single() {
|
||||
// TODO(brianwilkerson) Does not use all tokens.
|
||||
super.test_parseTypeParameterList_single();
|
||||
}
|
||||
}
|
||||
with SimpleParserTestMixin {}
|
||||
|
||||
/**
|
||||
* Tests of the fasta parser based on [StatementParserTestMixin].
|
||||
|
|
|
@ -11815,17 +11815,23 @@ class C {
|
|||
}
|
||||
|
||||
void test_missingIdentifier_afterAnnotation() {
|
||||
createParser('@override }');
|
||||
createParser('@override }', expectedEndOffset: 10);
|
||||
ClassMember member = parser.parseClassMember('C');
|
||||
expectNotNullIfNoErrors(member);
|
||||
listener.assertErrors(
|
||||
[expectedError(ParserErrorCode.EXPECTED_CLASS_MEMBER, 10, 1)]);
|
||||
expect(member, new isInstanceOf<MethodDeclaration>());
|
||||
MethodDeclaration method = member;
|
||||
expect(method.documentationComment, isNull);
|
||||
NodeList<Annotation> metadata = method.metadata;
|
||||
expect(metadata, hasLength(1));
|
||||
expect(metadata[0].name.name, "override");
|
||||
if (usingFastaParser) {
|
||||
// TODO(danrubel): Consider generating a sub method so that the
|
||||
// existing annotation can be associated with a class member.
|
||||
expect(member, isNull);
|
||||
} else {
|
||||
expect(member, new isInstanceOf<MethodDeclaration>());
|
||||
MethodDeclaration method = member;
|
||||
expect(method.documentationComment, isNull);
|
||||
NodeList<Annotation> metadata = method.metadata;
|
||||
expect(metadata, hasLength(1));
|
||||
expect(metadata[0].name.name, "override");
|
||||
}
|
||||
}
|
||||
|
||||
void test_missingSemicolon_varialeDeclarationList() {
|
||||
|
@ -14594,13 +14600,20 @@ Function<A>(core.List<core.int> x) m() => null;
|
|||
}
|
||||
|
||||
void test_parseTypeParameterList_single() {
|
||||
createParser('<<A>');
|
||||
createParser('<<A>', expectedEndOffset: 0);
|
||||
TypeParameterList parameterList = parser.parseTypeParameterList();
|
||||
expectNotNullIfNoErrors(parameterList);
|
||||
assertNoErrors();
|
||||
expect(parameterList.leftBracket, isNotNull);
|
||||
expect(parameterList.rightBracket, isNotNull);
|
||||
expect(parameterList.typeParameters, hasLength(1));
|
||||
if (usingFastaParser) {
|
||||
// TODO(danrubel): Consider splitting `<<` and marking the first `<`
|
||||
// as an unexpected token.
|
||||
expect(parameterList, isNull);
|
||||
assertNoErrors();
|
||||
} else {
|
||||
expectNotNullIfNoErrors(parameterList);
|
||||
assertNoErrors();
|
||||
expect(parameterList.leftBracket, isNotNull);
|
||||
expect(parameterList.rightBracket, isNotNull);
|
||||
expect(parameterList.typeParameters, hasLength(1));
|
||||
}
|
||||
}
|
||||
|
||||
void test_parseTypeParameterList_withTrailingEquals() {
|
||||
|
|
Loading…
Reference in a new issue