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 analyzer.test.src.task.general_test; | 5 library analyzer.test.src.task.general_test; |
6 | 6 |
7 import 'package:analyzer/src/generated/engine.dart'; | 7 import 'package:analyzer/src/generated/engine.dart'; |
8 import 'package:analyzer/src/generated/source.dart'; | 8 import 'package:analyzer/src/generated/source.dart'; |
9 import 'package:analyzer/src/task/general.dart'; | 9 import 'package:analyzer/src/task/general.dart'; |
10 import 'package:analyzer/task/general.dart'; | 10 import 'package:analyzer/task/general.dart'; |
11 import 'package:analyzer/task/model.dart'; | 11 import 'package:analyzer/task/model.dart'; |
12 import 'package:test/test.dart'; | 12 import 'package:test/test.dart'; |
13 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 13 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
14 import 'package:typed_mock/typed_mock.dart'; | 14 import 'package:typed_mock/typed_mock.dart'; |
15 | 15 |
16 import '../../generated/test_support.dart'; | 16 import '../../generated/test_support.dart'; |
17 import '../../utils.dart'; | |
18 | 17 |
19 main() { | 18 main() { |
20 initializeTestEnvironment(); | |
21 defineReflectiveSuite(() { | 19 defineReflectiveSuite(() { |
22 defineReflectiveTests(GetContentTaskTest); | 20 defineReflectiveTests(GetContentTaskTest); |
23 }); | 21 }); |
24 } | 22 } |
25 | 23 |
26 @reflectiveTest | 24 @reflectiveTest |
27 class GetContentTaskTest extends EngineTestCase { | 25 class GetContentTaskTest extends EngineTestCase { |
28 test_buildInputs() { | 26 test_buildInputs() { |
29 AnalysisTarget target = new TestSource(); | 27 AnalysisTarget target = new TestSource(); |
30 Map<String, TaskInput> inputs = GetContentTask.buildInputs(target); | 28 Map<String, TaskInput> inputs = GetContentTask.buildInputs(target); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 when(context.getContents(target)).thenThrow('My exception!'); | 74 when(context.getContents(target)).thenThrow('My exception!'); |
77 task.perform(); | 75 task.perform(); |
78 expect(task.caughtException, isNull); | 76 expect(task.caughtException, isNull); |
79 expect(task.outputs, hasLength(2)); | 77 expect(task.outputs, hasLength(2)); |
80 expect(task.outputs[CONTENT], ''); | 78 expect(task.outputs[CONTENT], ''); |
81 expect(task.outputs[MODIFICATION_TIME], -1); | 79 expect(task.outputs[MODIFICATION_TIME], -1); |
82 } | 80 } |
83 } | 81 } |
84 | 82 |
85 class _MockContext extends TypedMock implements AnalysisContext {} | 83 class _MockContext extends TypedMock implements AnalysisContext {} |
OLD | NEW |