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

Side by Side Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1180673008: Create LibraryElement with SDK context for SDK sources. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rollback model.dart change. Created 5 years, 6 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
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.task.dart_test; 5 library test.src.task.dart_test;
6 6
7 import 'package:analyzer/src/context/cache.dart'; 7 import 'package:analyzer/src/context/cache.dart';
8 import 'package:analyzer/src/generated/ast.dart'; 8 import 'package:analyzer/src/generated/ast.dart';
9 import 'package:analyzer/src/generated/constant.dart'; 9 import 'package:analyzer/src/generated/constant.dart';
10 import 'package:analyzer/src/generated/element.dart'; 10 import 'package:analyzer/src/generated/element.dart';
11 import 'package:analyzer/src/generated/engine.dart' 11 import 'package:analyzer/src/generated/engine.dart'
12 show AnalysisOptionsImpl, CacheState; 12 show AnalysisOptionsImpl, CacheState;
13 import 'package:analyzer/src/generated/error.dart'; 13 import 'package:analyzer/src/generated/error.dart';
14 import 'package:analyzer/src/generated/resolver.dart'; 14 import 'package:analyzer/src/generated/resolver.dart';
15 import 'package:analyzer/src/generated/sdk.dart';
15 import 'package:analyzer/src/generated/source.dart'; 16 import 'package:analyzer/src/generated/source.dart';
16 import 'package:analyzer/src/task/dart.dart'; 17 import 'package:analyzer/src/task/dart.dart';
17 import 'package:analyzer/task/dart.dart'; 18 import 'package:analyzer/task/dart.dart';
18 import 'package:analyzer/task/general.dart'; 19 import 'package:analyzer/task/general.dart';
19 import 'package:analyzer/task/model.dart'; 20 import 'package:analyzer/task/model.dart';
20 import 'package:unittest/unittest.dart'; 21 import 'package:unittest/unittest.dart';
21 22
22 import '../../generated/test_support.dart'; 23 import '../../generated/test_support.dart';
23 import '../../reflective_tests.dart'; 24 import '../../reflective_tests.dart';
24 import '../context/abstract_context.dart'; 25 import '../context/abstract_context.dart';
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 expect(combinator.offset, 33); 393 expect(combinator.offset, 33);
393 expect(combinator.end, 42); 394 expect(combinator.end, 42);
394 expect(combinator.shownNames, ['A', 'B']); 395 expect(combinator.shownNames, ['A', 'B']);
395 } 396 }
396 { 397 {
397 HideElementCombinator combinator = combinators[1]; 398 HideElementCombinator combinator = combinators[1];
398 expect(combinator.hiddenNames, ['C', 'D']); 399 expect(combinator.hiddenNames, ['C', 'D']);
399 } 400 }
400 } 401 }
401 402
403 test_perform_dartCoreContext() {
404 List<Source> sources = newSources({'/libA.dart': ''});
405 Source source = sources[0];
406 // perform task
407 _computeResult(source, LIBRARY_ELEMENT2);
408 expect(task, new isInstanceOf<BuildDirectiveElementsTask>());
409 // prepare outputs
410 LibraryElement libraryElement = outputs[LIBRARY_ELEMENT2];
411 // verify that dart:core has SDK context
412 {
413 LibraryElement coreLibrary = libraryElement.importedLibraries[0];
414 DartSdk dartSdk = context.sourceFactory.dartSdk;
415 expect(coreLibrary.context, same(dartSdk.context));
416 }
417 }
418
402 test_perform_error_exportOfNonLibrary() { 419 test_perform_error_exportOfNonLibrary() {
403 List<Source> sources = newSources({ 420 List<Source> sources = newSources({
404 '/libA.dart': ''' 421 '/libA.dart': '''
405 library libA; 422 library libA;
406 export 'part.dart'; 423 export 'part.dart';
407 ''', 424 ''',
408 '/part.dart': ''' 425 '/part.dart': '''
409 part of notLib; 426 part of notLib;
410 ''' 427 '''
411 }); 428 });
(...skipping 2301 matching lines...) Expand 10 before | Expand all | Expand 10 after
2713 /** 2730 /**
2714 * Fill [errorListener] with [result] errors in the current [task]. 2731 * Fill [errorListener] with [result] errors in the current [task].
2715 */ 2732 */
2716 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) { 2733 void _fillErrorListener(ResultDescriptor<List<AnalysisError>> result) {
2717 List<AnalysisError> errors = task.outputs[result]; 2734 List<AnalysisError> errors = task.outputs[result];
2718 expect(errors, isNotNull, reason: result.name); 2735 expect(errors, isNotNull, reason: result.name);
2719 errorListener = new GatheringErrorListener(); 2736 errorListener = new GatheringErrorListener();
2720 errorListener.addAll(errors); 2737 errorListener.addAll(errors);
2721 } 2738 }
2722 } 2739 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698