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

Side by Side Diff: pkg/analyzer/test/src/context/abstract_context.dart

Issue 1320273003: Clean up and improve some of the task tests (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.abstract_context_test; 5 library test.src.task.abstract_context_test;
6 6
7 import 'package:analyzer/file_system/file_system.dart'; 7 import 'package:analyzer/file_system/file_system.dart';
8 import 'package:analyzer/file_system/memory_file_system.dart'; 8 import 'package:analyzer/file_system/memory_file_system.dart';
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/context/context.dart'; 10 import 'package:analyzer/src/context/context.dart';
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 fail(buffer.toString()); 66 fail(buffer.toString());
67 } 67 }
68 } 68 }
69 expect(elements, hasLength(names.length)); 69 expect(elements, hasLength(names.length));
70 } 70 }
71 71
72 /** 72 /**
73 * Compute the given [result] for the given [target]. 73 * Compute the given [result] for the given [target].
74 */ 74 */
75 void computeResult(AnalysisTarget target, ResultDescriptor result) { 75 void computeResult(AnalysisTarget target, ResultDescriptor result,
76 {isInstanceOf matcher: null}) {
76 oldOutputs = outputs; 77 oldOutputs = outputs;
77 task = analysisDriver.computeResult(target, result); 78 task = analysisDriver.computeResult(target, result);
78 expect(task, isNotNull); 79 if (matcher == null) {
80 expect(task, isNotNull);
81 } else {
82 expect(task, matcher);
83 }
79 expect(task.caughtException, isNull); 84 expect(task.caughtException, isNull);
80 outputs = task.outputs; 85 outputs = task.outputs;
86 for (ResultDescriptor descriptor in task.descriptor.results) {
87 expect(outputs, contains(descriptor));
88 }
81 } 89 }
82 90
83 AnalysisContextImpl createAnalysisContext() { 91 AnalysisContextImpl createAnalysisContext() {
84 return new AnalysisContextImpl(); 92 return new AnalysisContextImpl();
85 } 93 }
86 94
87 Source newSource(String path, [String content = '']) { 95 Source newSource(String path, [String content = '']) {
88 File file = resourceProvider.newFile(path, content); 96 File file = resourceProvider.newFile(path, content);
89 return file.createSource(); 97 return file.createSource();
90 } 98 }
(...skipping 20 matching lines...) Expand all
111 analysisCache = context.analysisCache; 119 analysisCache = context.analysisCache;
112 analysisDriver = context.driver; 120 analysisDriver = context.driver;
113 } 121 }
114 122
115 void setUp() { 123 void setUp() {
116 prepareAnalysisContext(); 124 prepareAnalysisContext();
117 } 125 }
118 126
119 void tearDown() {} 127 void tearDown() {}
120 } 128 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698