Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(427)

Side by Side Diff: pkg/analyzer/test/src/task/general_test.dart

Issue 988993002: Test for GetContentTask. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/task/general.dart ('k') | pkg/analyzer/test/src/task/test_all.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library test.src.task.general_test;
6
7 import 'package:analyzer/src/generated/engine.dart'
8 hide AnalysisTask, GetContentTask;
9 import 'package:analyzer/src/generated/source.dart';
10 import 'package:analyzer/src/task/general.dart';
11 import 'package:analyzer/task/general.dart';
12 import 'package:analyzer/task/model.dart';
13 import 'package:typed_mock/typed_mock.dart';
14 import 'package:unittest/unittest.dart';
15
16 import '../../generated/test_support.dart';
17 import '../../reflective_tests.dart';
18
19 main() {
20 groupSep = ' | ';
21 runReflectiveTests(GetContentTaskTest);
22 }
23
24 @reflectiveTest
25 class GetContentTaskTest extends EngineTestCase {
26 test_buildInputs() {
27 AnalysisTarget target = new TestSource();
28 Map<String, TaskInput> inputs = GetContentTask.buildInputs(target);
29 expect(inputs, isEmpty);
30 }
31
32 test_constructor() {
33 AnalysisContext context = new _MockContext();
34 AnalysisTarget target = new TestSource();
35 GetContentTask task = new GetContentTask(context, target);
36 expect(task, isNotNull);
37 expect(task.context, context);
38 expect(task.target, target);
39 }
40
41 test_createTask() {
42 AnalysisContext context = new _MockContext();
43 AnalysisTarget target = new TestSource();
44 GetContentTask task = GetContentTask.createTask(context, target);
45 expect(task, isNotNull);
46 expect(task.context, context);
47 expect(task.target, target);
48 }
49
50 test_descriptor() {
51 AnalysisContext context = new _MockContext();
52 AnalysisTarget target = new TestSource();
53 GetContentTask task = new GetContentTask(context, target);
54 expect(task.descriptor, GetContentTask.DESCRIPTOR);
55 }
56
57 test_perform() {
58 AnalysisContext context = new _MockContext();
59 Source target = new TestSource();
60 GetContentTask task = new GetContentTask(context, target);
61 when(context.getContents(target))
62 .thenReturn(new TimestampedData<String>(42, 'foo'));
63 task.perform();
64 expect(task.caughtException, isNull);
65 expect(task.outputs, hasLength(2));
66 expect(task.outputs[CONTENT], 'foo');
67 expect(task.outputs[MODIFICATION_TIME], 42);
68 }
69 }
70
71 class _MockContext extends TypedMock implements AnalysisContext {
72 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
73 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/general.dart ('k') | pkg/analyzer/test/src/task/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698