OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |