Files
sdk/pkg/analyzer/test/generated/non_error_parser_test.dart
T
Sam Rawlins cad324cf79 Analyzer: Extract all parser tests to individual files
Change-Id: Ia3f85355186e25d4cc38fcb15ed3770a1db5805c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/176360
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-12-15 22:57:21 +00:00

44 lines
1.3 KiB
Dart

// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
// 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.
import 'package:analyzer/dart/ast/ast.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'parser_test_base.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(NonErrorParserTest);
});
}
@reflectiveTest
class NonErrorParserTest extends ParserTestCase {
void test_annotationOnEnumConstant_first() {
createParser("enum E { @override C }");
CompilationUnit unit = parser.parseCompilationUnit2();
expectNotNullIfNoErrors(unit);
assertNoErrors();
}
void test_annotationOnEnumConstant_middle() {
createParser("enum E { C, @override D, E }");
CompilationUnit unit = parser.parseCompilationUnit2();
expectNotNullIfNoErrors(unit);
assertNoErrors();
}
void test_staticMethod_notParsingFunctionBodies() {
ParserTestCase.parseFunctionBodies = false;
try {
createParser('class C { static void m() {} }');
CompilationUnit unit = parser.parseCompilationUnit2();
expectNotNullIfNoErrors(unit);
assertNoErrors();
} finally {
ParserTestCase.parseFunctionBodies = true;
}
}
}