Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2206)

Unified Diff: pkg/analyzer/test/generated/resolver_test.dart

Issue 2361433002: Async is no longer optional (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer/test/generated/parser_test.dart ('k') | pkg/analyzer/test/src/context/builder_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/resolver_test.dart
diff --git a/pkg/analyzer/test/generated/resolver_test.dart b/pkg/analyzer/test/generated/resolver_test.dart
index 6c089fa5dc7636a323cd13bd102dfea2165be425..1abacd6c1b6137bb1d340a954f68babd0ee37e21 100644
--- a/pkg/analyzer/test/generated/resolver_test.dart
+++ b/pkg/analyzer/test/generated/resolver_test.dart
@@ -12,7 +12,6 @@ import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
-import 'package:analyzer/src/context/context.dart';
import 'package:analyzer/src/dart/element/element.dart';
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/error/codes.dart';
@@ -37,7 +36,6 @@ main() {
initializeTestEnvironment();
defineReflectiveTests(AnalysisDeltaTest);
defineReflectiveTests(ChangeSetTest);
- defineReflectiveTests(DisableAsyncTestCase);
defineReflectiveTests(EnclosedScopeTest);
defineReflectiveTests(ErrorResolverTest);
defineReflectiveTests(LibraryImportScopeTest);
@@ -143,51 +141,6 @@ class ChangeSetTest extends EngineTestCase {
}
@reflectiveTest
-class DisableAsyncTestCase extends ResolverTestCase {
- @override
- void setUp() {
- AnalysisOptionsImpl options = new AnalysisOptionsImpl();
- options.enableAsync = false;
- resetWithOptions(options);
- }
-
- void test_resolve() {
- Source source = addSource(r'''
-class C {
- foo() {
- bar();
- }
- bar() {
- //
- }
-}''');
- computeLibrarySourceErrors(source);
- assertErrors(source, []);
- }
-
- void test_resolve_async() {
- Source source = addSource(r'''
-class C {
- Future foo() async {
- await bar();
- return null;
- }
- Future bar() {
- return new Future.delayed(new Duration(milliseconds: 10));
- }
-}''');
- computeLibrarySourceErrors(source);
- assertErrors(source, [
- StaticWarningCode.UNDEFINED_CLASS,
- StaticWarningCode.UNDEFINED_CLASS,
- StaticWarningCode.UNDEFINED_CLASS,
- StaticWarningCode.UNDEFINED_CLASS,
- ParserErrorCode.ASYNC_NOT_SUPPORTED
- ]);
- }
-}
-
-@reflectiveTest
class EnclosedScopeTest extends ResolverTestCase {
void test_define_duplicate() {
Scope rootScope = new _RootScope();
@@ -2551,79 +2504,6 @@ class TypeProviderImplTest extends EngineTestCase {
expect(provider.typeType, same(typeType));
}
- void test_creation_no_async() {
- //
- // Create a mock library element with the types expected to be in dart:core.
- // We cannot use either ElementFactory or TestTypeProvider (which uses
- // ElementFactory) because we side-effect the elements in ways that would
- // break other tests.
- //
- InterfaceType objectType = _classElement("Object", null).type;
- InterfaceType boolType = _classElement("bool", objectType).type;
- InterfaceType numType = _classElement("num", objectType).type;
- InterfaceType doubleType = _classElement("double", numType).type;
- InterfaceType functionType = _classElement("Function", objectType).type;
- InterfaceType intType = _classElement("int", numType).type;
- InterfaceType iterableType =
- _classElement("Iterable", objectType, ["T"]).type;
- InterfaceType listType = _classElement("List", objectType, ["E"]).type;
- InterfaceType mapType = _classElement("Map", objectType, ["K", "V"]).type;
- InterfaceType stackTraceType = _classElement("StackTrace", objectType).type;
- InterfaceType stringType = _classElement("String", objectType).type;
- InterfaceType symbolType = _classElement("Symbol", objectType).type;
- InterfaceType typeType = _classElement("Type", objectType).type;
- CompilationUnitElementImpl coreUnit =
- new CompilationUnitElementImpl("core.dart");
- coreUnit.types = <ClassElement>[
- boolType.element,
- doubleType.element,
- functionType.element,
- intType.element,
- iterableType.element,
- listType.element,
- mapType.element,
- objectType.element,
- stackTraceType.element,
- stringType.element,
- symbolType.element,
- typeType.element
- ];
- AnalysisContext context = AnalysisEngine.instance.createAnalysisContext();
- LibraryElementImpl coreLibrary = new LibraryElementImpl.forNode(
- context, AstFactory.libraryIdentifier2(["dart.core"]));
- coreLibrary.definingCompilationUnit = coreUnit;
-
- Source asyncSource = new NonExistingSource(
- 'async.dart', Uri.parse('dart:async'), UriKind.DART_URI);
- LibraryElementImpl mockAsyncLib = (context as AnalysisContextImpl)
- .createMockAsyncLib(coreLibrary, asyncSource);
- expect(mockAsyncLib.source, same(asyncSource));
- expect(mockAsyncLib.definingCompilationUnit.source, same(asyncSource));
- expect(mockAsyncLib.publicNamespace, isNotNull);
-
- //
- // Create a type provider and ensure that it can return the expected types.
- //
- TypeProviderImpl provider = new TypeProviderImpl(coreLibrary, mockAsyncLib);
- expect(provider.boolType, same(boolType));
- expect(provider.bottomType, isNotNull);
- expect(provider.doubleType, same(doubleType));
- expect(provider.dynamicType, isNotNull);
- expect(provider.functionType, same(functionType));
- InterfaceType mockFutureType = mockAsyncLib.getType('Future').type;
- expect(provider.futureType, same(mockFutureType));
- expect(provider.intType, same(intType));
- expect(provider.listType, same(listType));
- expect(provider.mapType, same(mapType));
- expect(provider.objectType, same(objectType));
- expect(provider.stackTraceType, same(stackTraceType));
- expect(provider.stringType, same(stringType));
- expect(provider.symbolType, same(symbolType));
- InterfaceType mockStreamType = mockAsyncLib.getType('Stream').type;
- expect(provider.streamType, same(mockStreamType));
- expect(provider.typeType, same(typeType));
- }
-
ClassElement _classElement(String typeName, InterfaceType superclassType,
[List<String> parameterNames]) {
ClassElementImpl element =
« no previous file with comments | « pkg/analyzer/test/generated/parser_test.dart ('k') | pkg/analyzer/test/src/context/builder_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698