| Index: packages/analyzer/test/src/context/context_test.dart
|
| diff --git a/packages/analyzer/test/src/context/context_test.dart b/packages/analyzer/test/src/context/context_test.dart
|
| index 0544bf56789d0e1808811cd27d21d7b1d1996e64..12f6fa7873ffd4f9a54b2432b4f91814c04b9290 100644
|
| --- a/packages/analyzer/test/src/context/context_test.dart
|
| +++ b/packages/analyzer/test/src/context/context_test.dart
|
| @@ -649,6 +649,15 @@ main() {}''');
|
| });
|
| }
|
|
|
| + void test_configurationData() {
|
| + var key = new ResultDescriptor('test_key', '');
|
| + var testData = ['test', 'data'];
|
| + context.setConfigurationData(key, testData);
|
| + expect(context.getConfigurationData(key), testData);
|
| + var unusedKey = new ResultDescriptor('unused_key', '');
|
| + expect(context.getConfigurationData(unusedKey), null);
|
| + }
|
| +
|
| void test_dispose() {
|
| expect(context.isDisposed, isFalse);
|
| context.dispose();
|
| @@ -905,7 +914,7 @@ class A {
|
| List<AnalysisError> errors = errorInfo.errors;
|
| expect(errors, hasLength(0));
|
| errors = context.computeErrors(source);
|
| - expect(errors, hasLength(3));
|
| + expect(errors, hasLength(2));
|
| }
|
|
|
| void test_getHtmlFilesReferencing_html() {
|
| @@ -1191,6 +1200,43 @@ export 'libA.dart';''');
|
| fail("The added source was not in the list of library sources");
|
| }
|
|
|
| + void test_getLibrarySources_inSDK() {
|
| + Source source = addSource(
|
| + '/test.dart',
|
| + r'''
|
| +import 'dart:async';
|
| +Stream S = null;
|
| +''');
|
| + LibraryElement testLibrary = context.computeLibraryElement(source);
|
| + // prepare "Stream" ClassElement
|
| + ClassElement streamElement;
|
| + {
|
| + CompilationUnitElement testUnit = testLibrary.definingCompilationUnit;
|
| + InterfaceType streamType = testUnit.topLevelVariables[0].type;
|
| + streamElement = streamType.element;
|
| + }
|
| + // must be from SDK context
|
| + AnalysisContext sdkContext = context.sourceFactory.dartSdk.context;
|
| + expect(sdkContext, streamElement.context);
|
| + Source intSource = streamElement.source;
|
| + // must be in the "async" library - SDK context
|
| + {
|
| + List<Source> coreLibraries = sdkContext.getLibrariesContaining(intSource);
|
| + expect(coreLibraries, hasLength(1));
|
| + Source coreSource = coreLibraries[0];
|
| + expect(coreSource.isInSystemLibrary, isTrue);
|
| + expect(coreSource.shortName, 'async.dart');
|
| + }
|
| + // must be in the "async" library - main context
|
| + {
|
| + List<Source> coreLibraries = context.getLibrariesContaining(intSource);
|
| + expect(coreLibraries, hasLength(1));
|
| + Source coreSource = coreLibraries[0];
|
| + expect(coreSource.isInSystemLibrary, isTrue);
|
| + expect(coreSource.shortName, 'async.dart');
|
| + }
|
| + }
|
| +
|
| void test_getLineInfo() {
|
| Source source = addSource(
|
| "/test.dart",
|
| @@ -1718,9 +1764,9 @@ void g() { f(null); }''');
|
| </script></body></html>''');
|
| _analyzeAll_assertFinished();
|
| context.computeErrors(htmlSource);
|
| - expect(_hasAnalysisErrorWithErrorSeverity(context.getErrors(htmlSource)),
|
| - isTrue,
|
| - reason: "htmlSource has an error");
|
| +// expect(_hasAnalysisErrorWithErrorSeverity(context.getErrors(htmlSource)),
|
| +// isTrue,
|
| +// reason: "htmlSource has an error");
|
| // add libB.dart and analyze
|
| Source libBSource = addSource("/libB.dart", "library libB;");
|
| _analyzeAll_assertFinished();
|
|
|