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

Side by Side Diff: pkg/analyzer/test/task/task_dart_test.dart

Issue 1150863007: Remove many explicit references to AnalysisContextImpl and enable testing of the new task model (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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/test/generated/test_support.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) 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.engine.task.dart; 5 library test.engine.task.dart;
6 6
7 import 'package:analyzer/src/generated/ast.dart'; 7 import 'package:analyzer/src/generated/ast.dart';
8 import 'package:analyzer/src/generated/engine.dart'; 8 import 'package:analyzer/src/generated/engine.dart';
9 import 'package:analyzer/src/generated/java_engine.dart'; 9 import 'package:analyzer/src/generated/java_engine.dart';
10 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 Source source = new TestSource('/part.dart'); 56 Source source = new TestSource('/part.dart');
57 Source library = new TestSource('/lib.dart'); 57 Source library = new TestSource('/lib.dart');
58 BuildUnitElementTask task = 58 BuildUnitElementTask task =
59 new BuildUnitElementTask(null, source, library, null); 59 new BuildUnitElementTask(null, source, library, null);
60 expect(task.source, equals(source)); 60 expect(task.source, equals(source));
61 } 61 }
62 62
63 void test_perform_exception() { 63 void test_perform_exception() {
64 TestSource source = new TestSource(); 64 TestSource source = new TestSource();
65 source.generateExceptionOnRead = true; 65 source.generateExceptionOnRead = true;
66 InternalAnalysisContext context = new AnalysisContextImpl(); 66 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore();
67 context.sourceFactory = new SourceFactory([new FileUriResolver()]);
68 CompilationUnit unit = parseUnit(context, source, ""); 67 CompilationUnit unit = parseUnit(context, source, "");
69 BuildUnitElementTask task = 68 BuildUnitElementTask task =
70 new BuildUnitElementTask(context, null, source, unit); 69 new BuildUnitElementTask(context, null, source, unit);
71 task.perform(new BuildUnitElementTaskTV_perform_exception()); 70 task.perform(new BuildUnitElementTaskTV_perform_exception());
72 } 71 }
73 72
74 void test_perform_valid() { 73 void test_perform_valid() {
75 var content = """ 74 var content = """
76 library lib; 75 library lib;
77 class A {}"""; 76 class A {}""";
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 if (exception != null) { 109 if (exception != null) {
111 throw exception; 110 throw exception;
112 } 111 }
113 expect(task.source, equals(source)); 112 expect(task.source, equals(source));
114 expect(task.library, equals(source)); 113 expect(task.library, equals(source));
115 expect(task.unit, equals(unit)); 114 expect(task.unit, equals(unit));
116 expect(task.unitElement, isNotNull); 115 expect(task.unitElement, isNotNull);
117 return true; 116 return true;
118 } 117 }
119 } 118 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/test_support.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698