| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 source.generateExceptionOnRead = true; | 54 source.generateExceptionOnRead = true; |
| 55 InternalAnalysisContext context = new AnalysisContextImpl(); | 55 InternalAnalysisContext context = new AnalysisContextImpl(); |
| 56 context.sourceFactory = new SourceFactory([new FileUriResolver()]); | 56 context.sourceFactory = new SourceFactory([new FileUriResolver()]); |
| 57 CompilationUnit unit = parseUnit(context, source, ""); | 57 CompilationUnit unit = parseUnit(context, source, ""); |
| 58 BuildUnitElementTask task = | 58 BuildUnitElementTask task = |
| 59 new BuildUnitElementTask(context, null, source, unit); | 59 new BuildUnitElementTask(context, null, source, unit); |
| 60 task.perform(new BuildUnitElementTaskTV_perform_exception()); | 60 task.perform(new BuildUnitElementTaskTV_perform_exception()); |
| 61 } | 61 } |
| 62 | 62 |
| 63 void test_perform_valid() { | 63 void test_perform_valid() { |
| 64 var content = EngineTestCase.createSource(["library lib;", "class A {}"]); | 64 var content = """ |
| 65 library lib; |
| 66 class A {}"""; |
| 65 Source source = new TestSource('/test.dart', content); | 67 Source source = new TestSource('/test.dart', content); |
| 66 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); | 68 InternalAnalysisContext context = AnalysisContextFactory.contextWithCore(); |
| 67 CompilationUnit unit = parseUnit(context, source, content); | 69 CompilationUnit unit = parseUnit(context, source, content); |
| 68 BuildUnitElementTask task = | 70 BuildUnitElementTask task = |
| 69 new BuildUnitElementTask(context, source, source, unit); | 71 new BuildUnitElementTask(context, source, source, unit); |
| 70 task.perform(new BuildUnitElementTaskTV_perform_valid(source, unit)); | 72 task.perform(new BuildUnitElementTaskTV_perform_valid(source, unit)); |
| 71 } | 73 } |
| 72 | 74 |
| 73 CompilationUnit parseUnit(InternalAnalysisContext context, Source source, Stri
ng content) { | 75 CompilationUnit parseUnit(InternalAnalysisContext context, Source source, Stri
ng content) { |
| 74 ScanDartTask scanTask = new ScanDartTask( | 76 ScanDartTask scanTask = new ScanDartTask( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if (exception != null) { | 114 if (exception != null) { |
| 113 throw exception; | 115 throw exception; |
| 114 } | 116 } |
| 115 expect(task.source, equals(source)); | 117 expect(task.source, equals(source)); |
| 116 expect(task.library, equals(source)); | 118 expect(task.library, equals(source)); |
| 117 expect(task.unit, equals(unit)); | 119 expect(task.unit, equals(unit)); |
| 118 expect(task.unitElement, isNotNull); | 120 expect(task.unitElement, isNotNull); |
| 119 return true; | 121 return true; |
| 120 } | 122 } |
| 121 } | 123 } |
| OLD | NEW |