| OLD | NEW |
| 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.model_test; | 5 library test.src.task.model_test; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; | 7 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; |
| 8 import 'package:analyzer/src/generated/java_engine.dart'; | 8 import 'package:analyzer/src/generated/java_engine.dart'; |
| 9 import 'package:analyzer/src/task/model.dart'; | 9 import 'package:analyzer/src/task/model.dart'; |
| 10 import 'package:analyzer/task/model.dart'; | 10 import 'package:analyzer/task/model.dart'; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 test_getRequiredSource() { | 51 test_getRequiredSource() { |
| 52 AnalysisTarget target = new TestSource(); | 52 AnalysisTarget target = new TestSource(); |
| 53 AnalysisTask task = new TestAnalysisTask(null, target); | 53 AnalysisTask task = new TestAnalysisTask(null, target); |
| 54 expect(task.getRequiredSource(), target); | 54 expect(task.getRequiredSource(), target); |
| 55 } | 55 } |
| 56 } | 56 } |
| 57 | 57 |
| 58 @reflectiveTest | 58 @reflectiveTest |
| 59 class ContributionPointImplTest extends EngineTestCase { | 59 class ContributionPointImplTest extends EngineTestCase { |
| 60 test_contributors_empty() { | 60 test_contributors_empty() { |
| 61 CompositeResultDescriptorImpl point = new CompositeResultDescriptorImpl('poi
nt'); | 61 CompositeResultDescriptorImpl point = |
| 62 new CompositeResultDescriptorImpl('point'); |
| 62 List<ResultDescriptor> contributors = point.contributors; | 63 List<ResultDescriptor> contributors = point.contributors; |
| 63 expect(contributors, isEmpty); | 64 expect(contributors, isEmpty); |
| 64 } | 65 } |
| 65 | 66 |
| 66 test_contributors_nonEmpty() { | 67 test_contributors_nonEmpty() { |
| 67 ResultDescriptorImpl result1 = new ResultDescriptorImpl('result1', null); | 68 ResultDescriptorImpl result1 = new ResultDescriptorImpl('result1', null); |
| 68 ResultDescriptorImpl result2 = new ResultDescriptorImpl('result2', null); | 69 ResultDescriptorImpl result2 = new ResultDescriptorImpl('result2', null); |
| 69 CompositeResultDescriptorImpl point = new CompositeResultDescriptorImpl('poi
nt'); | 70 CompositeResultDescriptorImpl point = |
| 71 new CompositeResultDescriptorImpl('point'); |
| 70 point.recordContributor(result1); | 72 point.recordContributor(result1); |
| 71 point.recordContributor(result2); | 73 point.recordContributor(result2); |
| 72 List<ResultDescriptor> contributors = point.contributors; | 74 List<ResultDescriptor> contributors = point.contributors; |
| 73 expect(contributors, isNotNull); | 75 expect(contributors, isNotNull); |
| 74 expect(contributors, hasLength(2)); | 76 expect(contributors, hasLength(2)); |
| 75 if (!(contributors[0] == result1 && contributors[1] == result2) || | 77 if (!(contributors[0] == result1 && contributors[1] == result2) || |
| 76 (contributors[0] == result2 && contributors[1] == result1)) { | 78 (contributors[0] == result2 && contributors[1] == result1)) { |
| 77 fail("Invalid contributors: $contributors"); | 79 fail("Invalid contributors: $contributors"); |
| 78 } | 80 } |
| 79 } | 81 } |
| 80 | 82 |
| 81 test_create() { | 83 test_create() { |
| 82 expect(new CompositeResultDescriptorImpl('name'), isNotNull); | 84 expect(new CompositeResultDescriptorImpl('name'), isNotNull); |
| 83 } | 85 } |
| 84 | 86 |
| 85 test_name() { | 87 test_name() { |
| 86 String name = 'point'; | 88 String name = 'point'; |
| 87 CompositeResultDescriptorImpl point = new CompositeResultDescriptorImpl(name
); | 89 CompositeResultDescriptorImpl point = |
| 90 new CompositeResultDescriptorImpl(name); |
| 88 expect(point.name, name); | 91 expect(point.name, name); |
| 89 } | 92 } |
| 90 } | 93 } |
| 91 | 94 |
| 92 @reflectiveTest | 95 @reflectiveTest |
| 93 class ResultDescriptorImplTest extends EngineTestCase { | 96 class ResultDescriptorImplTest extends EngineTestCase { |
| 94 test_create_withContribution() { | 97 test_create_withContribution() { |
| 95 CompositeResultDescriptorImpl point = new CompositeResultDescriptorImpl('poi
nt'); | 98 CompositeResultDescriptorImpl point = |
| 99 new CompositeResultDescriptorImpl('point'); |
| 96 ResultDescriptorImpl result = | 100 ResultDescriptorImpl result = |
| 97 new ResultDescriptorImpl('result', null, contributesTo: point); | 101 new ResultDescriptorImpl('result', null, contributesTo: point); |
| 98 expect(result, isNotNull); | 102 expect(result, isNotNull); |
| 99 List<ResultDescriptor> contributors = point.contributors; | 103 List<ResultDescriptor> contributors = point.contributors; |
| 100 expect(contributors, unorderedEquals([result])); | 104 expect(contributors, unorderedEquals([result])); |
| 101 } | 105 } |
| 102 | 106 |
| 103 test_create_withoutContribution() { | 107 test_create_withoutContribution() { |
| 104 expect(new ResultDescriptorImpl('name', null), isNotNull); | 108 expect(new ResultDescriptorImpl('name', null), isNotNull); |
| 105 } | 109 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 test_createTask() { | 141 test_createTask() { |
| 138 BuildTask buildTask = | 142 BuildTask buildTask = |
| 139 (context, target) => new TestAnalysisTask(context, target); | 143 (context, target) => new TestAnalysisTask(context, target); |
| 140 CreateTaskInputs createTaskInputs = (target) {}; | 144 CreateTaskInputs createTaskInputs = (target) {}; |
| 141 List<ResultDescriptor> results = <ResultDescriptor>[]; | 145 List<ResultDescriptor> results = <ResultDescriptor>[]; |
| 142 TaskDescriptorImpl descriptor = | 146 TaskDescriptorImpl descriptor = |
| 143 new TaskDescriptorImpl('name', buildTask, createTaskInputs, results); | 147 new TaskDescriptorImpl('name', buildTask, createTaskInputs, results); |
| 144 AnalysisContext context = null; | 148 AnalysisContext context = null; |
| 145 AnalysisTarget target = new TestSource(); | 149 AnalysisTarget target = new TestSource(); |
| 146 Map<String, dynamic> inputs = {}; | 150 Map<String, dynamic> inputs = {}; |
| 147 AnalysisTask createTask = descriptor.createTask(context, target, inputs); | 151 String inputMemento = 'main() {}'; |
| 152 AnalysisTask createTask = |
| 153 descriptor.createTask(context, target, inputs, inputMemento); |
| 148 expect(createTask, isNotNull); | 154 expect(createTask, isNotNull); |
| 149 expect(createTask.context, context); | 155 expect(createTask.context, context); |
| 150 expect(createTask.inputs, inputs); | 156 expect(createTask.inputs, inputs); |
| 157 expect(createTask.inputMemento, inputMemento); |
| 151 expect(createTask.target, target); | 158 expect(createTask.target, target); |
| 152 } | 159 } |
| 153 } | 160 } |
| OLD | NEW |