| 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 ContributionPointImpl point = new ContributionPointImpl('point'); | 61 CompositeResultDescriptorImpl point = new CompositeResultDescriptorImpl('poi
nt'); |
| 62 List<ResultDescriptor> contributors = point.contributors; | 62 List<ResultDescriptor> contributors = point.contributors; |
| 63 expect(contributors, isEmpty); | 63 expect(contributors, isEmpty); |
| 64 } | 64 } |
| 65 | 65 |
| 66 test_contributors_nonEmpty() { | 66 test_contributors_nonEmpty() { |
| 67 ResultDescriptorImpl result1 = new ResultDescriptorImpl('result1', null); | 67 ResultDescriptorImpl result1 = new ResultDescriptorImpl('result1', null); |
| 68 ResultDescriptorImpl result2 = new ResultDescriptorImpl('result2', null); | 68 ResultDescriptorImpl result2 = new ResultDescriptorImpl('result2', null); |
| 69 ContributionPointImpl point = new ContributionPointImpl('point'); | 69 CompositeResultDescriptorImpl point = new CompositeResultDescriptorImpl('poi
nt'); |
| 70 point.recordContributor(result1); | 70 point.recordContributor(result1); |
| 71 point.recordContributor(result2); | 71 point.recordContributor(result2); |
| 72 List<ResultDescriptor> contributors = point.contributors; | 72 List<ResultDescriptor> contributors = point.contributors; |
| 73 expect(contributors, isNotNull); | 73 expect(contributors, isNotNull); |
| 74 expect(contributors, hasLength(2)); | 74 expect(contributors, hasLength(2)); |
| 75 if (!(contributors[0] == result1 && contributors[1] == result2) || | 75 if (!(contributors[0] == result1 && contributors[1] == result2) || |
| 76 (contributors[0] == result2 && contributors[1] == result1)) { | 76 (contributors[0] == result2 && contributors[1] == result1)) { |
| 77 fail("Invalid contributors: $contributors"); | 77 fail("Invalid contributors: $contributors"); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 | 80 |
| 81 test_create() { | 81 test_create() { |
| 82 expect(new ContributionPointImpl('name'), isNotNull); | 82 expect(new CompositeResultDescriptorImpl('name'), isNotNull); |
| 83 } | 83 } |
| 84 | 84 |
| 85 test_name() { | 85 test_name() { |
| 86 String name = 'point'; | 86 String name = 'point'; |
| 87 ContributionPointImpl point = new ContributionPointImpl(name); | 87 CompositeResultDescriptorImpl point = new CompositeResultDescriptorImpl(name
); |
| 88 expect(point.name, name); | 88 expect(point.name, name); |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 @reflectiveTest | 92 @reflectiveTest |
| 93 class ResultDescriptorImplTest extends EngineTestCase { | 93 class ResultDescriptorImplTest extends EngineTestCase { |
| 94 test_create_withContribution() { | 94 test_create_withContribution() { |
| 95 ContributionPointImpl point = new ContributionPointImpl('point'); | 95 CompositeResultDescriptorImpl point = new CompositeResultDescriptorImpl('poi
nt'); |
| 96 ResultDescriptorImpl result = | 96 ResultDescriptorImpl result = |
| 97 new ResultDescriptorImpl('result', null, contributesTo: point); | 97 new ResultDescriptorImpl('result', null, contributesTo: point); |
| 98 expect(result, isNotNull); | 98 expect(result, isNotNull); |
| 99 List<ResultDescriptor> contributors = point.contributors; | 99 List<ResultDescriptor> contributors = point.contributors; |
| 100 expect(contributors, unorderedEquals([result])); | 100 expect(contributors, unorderedEquals([result])); |
| 101 } | 101 } |
| 102 | 102 |
| 103 test_create_withoutContribution() { | 103 test_create_withoutContribution() { |
| 104 expect(new ResultDescriptorImpl('name', null), isNotNull); | 104 expect(new ResultDescriptorImpl('name', null), isNotNull); |
| 105 } | 105 } |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 AnalysisContext context = null; | 144 AnalysisContext context = null; |
| 145 AnalysisTarget target = new TestSource(); | 145 AnalysisTarget target = new TestSource(); |
| 146 Map<String, dynamic> inputs = {}; | 146 Map<String, dynamic> inputs = {}; |
| 147 AnalysisTask createTask = descriptor.createTask(context, target, inputs); | 147 AnalysisTask createTask = descriptor.createTask(context, target, inputs); |
| 148 expect(createTask, isNotNull); | 148 expect(createTask, isNotNull); |
| 149 expect(createTask.context, context); | 149 expect(createTask.context, context); |
| 150 expect(createTask.inputs, inputs); | 150 expect(createTask.inputs, inputs); |
| 151 expect(createTask.target, target); | 151 expect(createTask.target, target); |
| 152 } | 152 } |
| 153 } | 153 } |
| OLD | NEW |