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

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

Issue 1005693007: Add toMap / toMapOf / toList (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes for review comments. 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/task/model.dart ('k') | pkg/analyzer/test/src/task/inputs_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.driver_test; 5 library test.src.task.driver_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/src/cancelable_future.dart'; 10 import 'package:analyzer/src/cancelable_future.dart';
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 driver.performWorkItem(item); 307 driver.performWorkItem(item);
308 CacheEntry targetEntry = context.getCacheEntry(item.target); 308 CacheEntry targetEntry = context.getCacheEntry(item.target);
309 expect(targetEntry.exception, exception); 309 expect(targetEntry.exception, exception);
310 expect(targetEntry.getState(result), CacheState.ERROR); 310 expect(targetEntry.getState(result), CacheState.ERROR);
311 } 311 }
312 312
313 test_reset() { 313 test_reset() {
314 ResultDescriptor inputResult = new ResultDescriptor('input', null); 314 ResultDescriptor inputResult = new ResultDescriptor('input', null);
315 TaskDescriptor descriptor = new TaskDescriptor('task', 315 TaskDescriptor descriptor = new TaskDescriptor('task',
316 (context, target) => new TestAnalysisTask(context, target), 316 (context, target) => new TestAnalysisTask(context, target),
317 (target) => {'one': inputResult.inputFor(target)}, 317 (target) => {'one': inputResult.of(target)},
318 [new ResultDescriptor('output', null)]); 318 [new ResultDescriptor('output', null)]);
319 driver.currentWorkOrder = 319 driver.currentWorkOrder =
320 new WorkOrder(manager, new WorkItem(null, null, descriptor)); 320 new WorkOrder(manager, new WorkItem(null, null, descriptor));
321 321
322 driver.reset(); 322 driver.reset();
323 expect(driver.currentWorkOrder, isNull); 323 expect(driver.currentWorkOrder, isNull);
324 } 324 }
325 325
326 /** 326 /**
327 * [complete] is `true` if the value of the result has already been computed. 327 * [complete] is `true` if the value of the result has already been computed.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 380 }
381 381
382 test_buildTask_incomplete() { 382 test_buildTask_incomplete() {
383 AnalysisContext context = new _TestContext(); 383 AnalysisContext context = new _TestContext();
384 AnalysisTarget target = new TestSource(); 384 AnalysisTarget target = new TestSource();
385 ResultDescriptor inputResult = new ResultDescriptor('input', null); 385 ResultDescriptor inputResult = new ResultDescriptor('input', null);
386 List<ResultDescriptor> outputResults = 386 List<ResultDescriptor> outputResults =
387 <ResultDescriptor>[new ResultDescriptor('output', null)]; 387 <ResultDescriptor>[new ResultDescriptor('output', null)];
388 TaskDescriptor descriptor = new TaskDescriptor('task', (context, target) => 388 TaskDescriptor descriptor = new TaskDescriptor('task', (context, target) =>
389 new TestAnalysisTask(context, target, results: outputResults), 389 new TestAnalysisTask(context, target, results: outputResults),
390 (target) => {'one': inputResult.inputFor(target)}, outputResults); 390 (target) => {'one': inputResult.of(target)}, outputResults);
391 WorkItem item = new WorkItem(context, target, descriptor); 391 WorkItem item = new WorkItem(context, target, descriptor);
392 expect(() => item.buildTask(), throwsStateError); 392 expect(() => item.buildTask(), throwsStateError);
393 } 393 }
394 394
395 test_create() { 395 test_create() {
396 AnalysisContext context = new _TestContext(); 396 AnalysisContext context = new _TestContext();
397 AnalysisTarget target = new TestSource(); 397 AnalysisTarget target = new TestSource();
398 TaskDescriptor descriptor = new TaskDescriptor( 398 TaskDescriptor descriptor = new TaskDescriptor(
399 'task', null, (target) => {}, [new ResultDescriptor('result', null)]); 399 'task', null, (target) => {}, [new ResultDescriptor('result', null)]);
400 WorkItem item = new WorkItem(context, target, descriptor); 400 WorkItem item = new WorkItem(context, target, descriptor);
(...skipping 20 matching lines...) Expand all
421 TaskManager manager = new TaskManager(); 421 TaskManager manager = new TaskManager();
422 AnalysisContext context = new _TestContext(); 422 AnalysisContext context = new _TestContext();
423 AnalysisTarget target = new TestSource(); 423 AnalysisTarget target = new TestSource();
424 ResultDescriptor resultA = new ResultDescriptor('resultA', null); 424 ResultDescriptor resultA = new ResultDescriptor('resultA', null);
425 ResultDescriptor resultB = new ResultDescriptor('resultB', null); 425 ResultDescriptor resultB = new ResultDescriptor('resultB', null);
426 TaskDescriptor task1 = new TaskDescriptor('task', (context, target) => 426 TaskDescriptor task1 = new TaskDescriptor('task', (context, target) =>
427 new TestAnalysisTask(context, target, results: [resultA]), 427 new TestAnalysisTask(context, target, results: [resultA]),
428 (target) => {}, [resultA]); 428 (target) => {}, [resultA]);
429 TaskDescriptor task2 = new TaskDescriptor('task', 429 TaskDescriptor task2 = new TaskDescriptor('task',
430 (context, target) => new TestAnalysisTask(context, target), 430 (context, target) => new TestAnalysisTask(context, target),
431 (target) => {'one': resultA.inputFor(target)}, [resultB]); 431 (target) => {'one': resultA.of(target)}, [resultB]);
432 manager.addTaskDescriptor(task1); 432 manager.addTaskDescriptor(task1);
433 manager.addTaskDescriptor(task2); 433 manager.addTaskDescriptor(task2);
434 WorkItem item = new WorkItem(context, target, task2); 434 WorkItem item = new WorkItem(context, target, task2);
435 expect(item.gatherInputs(manager), isNotNull); 435 expect(item.gatherInputs(manager), isNotNull);
436 } 436 }
437 437
438 test_gatherInputs_invalid() { 438 test_gatherInputs_invalid() {
439 TaskManager manager = new TaskManager(); 439 TaskManager manager = new TaskManager();
440 AnalysisContext context = new _TestContext(); 440 AnalysisContext context = new _TestContext();
441 AnalysisTarget target = new TestSource(); 441 AnalysisTarget target = new TestSource();
442 ResultDescriptor inputResult = new ResultDescriptor('input', null); 442 ResultDescriptor inputResult = new ResultDescriptor('input', null);
443 TaskDescriptor descriptor = new TaskDescriptor('task', 443 TaskDescriptor descriptor = new TaskDescriptor('task',
444 (context, target) => new TestAnalysisTask(context, target), 444 (context, target) => new TestAnalysisTask(context, target),
445 (target) => {'one': inputResult.inputFor(target)}, 445 (target) => {'one': inputResult.of(target)},
446 [new ResultDescriptor('output', null)]); 446 [new ResultDescriptor('output', null)]);
447 WorkItem item = new WorkItem(context, target, descriptor); 447 WorkItem item = new WorkItem(context, target, descriptor);
448 WorkItem result = item.gatherInputs(manager); 448 WorkItem result = item.gatherInputs(manager);
449 expect(result, isNull); 449 expect(result, isNull);
450 expect(item.exception, isNotNull); 450 expect(item.exception, isNotNull);
451 } 451 }
452 } 452 }
453 453
454 @reflectiveTest 454 @reflectiveTest
455 class WorkOrderTest extends EngineTestCase { 455 class WorkOrderTest extends EngineTestCase {
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 void setContents(Source source, String contents) { 832 void setContents(Source source, String contents) {
833 baseContext.setContents(source, contents); 833 baseContext.setContents(source, contents);
834 } 834 }
835 835
836 @override 836 @override
837 void visitCacheItems(void callback(Source source, SourceEntry dartEntry, 837 void visitCacheItems(void callback(Source source, SourceEntry dartEntry,
838 DataDescriptor rowDesc, CacheState state)) { 838 DataDescriptor rowDesc, CacheState state)) {
839 baseContext.visitCacheItems(callback); 839 baseContext.visitCacheItems(callback);
840 } 840 }
841 } 841 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/task/model.dart ('k') | pkg/analyzer/test/src/task/inputs_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698