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

Side by Side Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 1399873002: Issue 24538. Route SDK results into SDK context DartWorkManager. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.src.context.context_test; 5 library test.src.context.context_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analyzer/file_system/memory_file_system.dart'; 9 import 'package:analyzer/file_system/memory_file_system.dart';
10 import 'package:analyzer/src/cancelable_future.dart'; 10 import 'package:analyzer/src/cancelable_future.dart';
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 sources = context.librarySources; 1184 sources = context.librarySources;
1185 expect(sources, hasLength(originalLength + 1)); 1185 expect(sources, hasLength(originalLength + 1));
1186 for (Source returnedSource in sources) { 1186 for (Source returnedSource in sources) {
1187 if (returnedSource == source) { 1187 if (returnedSource == source) {
1188 return; 1188 return;
1189 } 1189 }
1190 } 1190 }
1191 fail("The added source was not in the list of library sources"); 1191 fail("The added source was not in the list of library sources");
1192 } 1192 }
1193 1193
1194 void test_getLibrarySources_inSDK() {
1195 Source source = addSource(
1196 '/test.dart',
1197 r'''
1198 import 'dart:async';
1199 Stream S = null;
1200 ''');
1201 LibraryElement testLibrary = context.computeLibraryElement(source);
1202 // prepare "Stream" ClassElement
1203 ClassElement streamElement;
1204 {
1205 CompilationUnitElement testUnit = testLibrary.definingCompilationUnit;
1206 InterfaceType streamType = testUnit.topLevelVariables[0].type;
1207 streamElement = streamType.element;
1208 }
1209 // must be from SDK context
1210 AnalysisContext sdkContext = context.sourceFactory.dartSdk.context;
1211 expect(sdkContext, streamElement.context);
1212 // must be in the "async" library
1213 Source intSource = streamElement.source;
1214 List<Source> coreLibraries = sdkContext.getLibrariesContaining(intSource);
1215 expect(coreLibraries, hasLength(1));
1216 Source coreSource = coreLibraries[0];
1217 expect(coreSource.isInSystemLibrary, isTrue);
1218 expect(coreSource.shortName, 'async.dart');
1219 }
1220
1194 void test_getLineInfo() { 1221 void test_getLineInfo() {
1195 Source source = addSource( 1222 Source source = addSource(
1196 "/test.dart", 1223 "/test.dart",
1197 r''' 1224 r'''
1198 library lib; 1225 library lib;
1199 1226
1200 main() {}'''); 1227 main() {}''');
1201 LineInfo info = context.getLineInfo(source); 1228 LineInfo info = context.getLineInfo(source);
1202 expect(info, isNull); 1229 expect(info, isNull);
1203 context.parseCompilationUnit(source); 1230 context.parseCompilationUnit(source);
(...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after
2515 } 2542 }
2516 } 2543 }
2517 2544
2518 class _AnalysisContextImplTest_test_applyChanges_removeContainer 2545 class _AnalysisContextImplTest_test_applyChanges_removeContainer
2519 implements SourceContainer { 2546 implements SourceContainer {
2520 Source libB; 2547 Source libB;
2521 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB); 2548 _AnalysisContextImplTest_test_applyChanges_removeContainer(this.libB);
2522 @override 2549 @override
2523 bool contains(Source source) => source == libB; 2550 bool contains(Source source) => source == libB;
2524 } 2551 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/engine_test.dart ('k') | pkg/analyzer/test/src/context/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698