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

Unified Diff: packages/analyzer/test/src/context/context_test.dart

Issue 1521693002: Roll Observatory deps (charted -> ^0.3.0) (Closed) Base URL: https://chromium.googlesource.com/external/github.com/dart-lang/observatory_pub_packages.git@master
Patch Set: Created 5 years 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 | « packages/analyzer/test/generated/parser_test.dart ('k') | packages/analyzer/test/src/context/mock_sdk.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « packages/analyzer/test/generated/parser_test.dart ('k') | packages/analyzer/test/src/context/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698