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

Side by Side Diff: pkg/scheduled_test/lib/src/schedule.dart

Issue 12853005: Change the way Patterns work in scheduled_test/descriptor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add Nothing.validateNow. Created 7 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 schedule; 5 library schedule;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import '../../../../pkg/unittest/lib/unittest.dart' as unittest; 10 import '../../../../pkg/unittest/lib/unittest.dart' as unittest;
11 11
12 import 'mock_clock.dart' as mock_clock; 12 import 'mock_clock.dart' as mock_clock;
13 import 'schedule_error.dart'; 13 import 'schedule_error.dart';
14 import 'substitute_future.dart'; 14 import 'substitute_future.dart';
15 import 'task.dart'; 15 import 'task.dart';
16 import 'utils.dart';
16 import 'value_future.dart'; 17 import 'value_future.dart';
17 18
18 /// The schedule of tasks to run for a single test. This has three separate task 19 /// The schedule of tasks to run for a single test. This has three separate task
19 /// queues: [tasks], [onComplete], and [onException]. It also provides 20 /// queues: [tasks], [onComplete], and [onException]. It also provides
20 /// visibility into the current state of the schedule. 21 /// visibility into the current state of the schedule.
21 class Schedule { 22 class Schedule {
22 /// The main task queue for the schedule. These tasks are run before the other 23 /// The main task queue for the schedule. These tasks are run before the other
23 /// queues and generally constitute the main test body. 24 /// queues and generally constitute the main test body.
24 TaskQueue get tasks => _tasks; 25 TaskQueue get tasks => _tasks;
25 TaskQueue _tasks; 26 TaskQueue _tasks;
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 522
522 String toString() => name; 523 String toString() => name;
523 524
524 /// Returns a detailed representation of the queue as a tree of tasks. If 525 /// Returns a detailed representation of the queue as a tree of tasks. If
525 /// [highlight] is passed, that task is specially highlighted. 526 /// [highlight] is passed, that task is specially highlighted.
526 /// 527 ///
527 /// [highlight] must be a task in this queue. 528 /// [highlight] must be a task in this queue.
528 String generateTree([Task highlight]) { 529 String generateTree([Task highlight]) {
529 assert(highlight == null || highlight.queue == this); 530 assert(highlight == null || highlight.queue == this);
530 return _contents.map((task) { 531 return _contents.map((task) {
531 var lines = task.toString().split("\n"); 532 var taskString = prefixLines(task.toString(),
532 var firstLine = task == highlight ? 533 firstPrefix: task == highlight ? "> " : "* ");
533 "> ${lines.first}" : "* ${lines.first}";
534 lines = new List.from(lines.skip(1).map((line) => "| $line"));
535 lines.insertRange(0, 1, firstLine);
536 534
537 if (task == highlight && !task.children.isEmpty) { 535 if (task == highlight && !task.children.isEmpty) {
538 for (var child in task.children) { 536 var childrenString = task.children.map((child) {
539 var prefix = ">"; 537 var prefix = ">";
540 if (child.state == TaskState.ERROR) { 538 if (child.state == TaskState.ERROR) {
541 prefix = "X"; 539 prefix = "X";
542 } else if (child.state == TaskState.SUCCESS) { 540 } else if (child.state == TaskState.SUCCESS) {
543 prefix = "*"; 541 prefix = "*";
544 } 542 }
545 543
546 var childLines = child.toString().split("\n"); 544 return prefixLines(child.toString(),
547 lines.add(" $prefix ${childLines.first}"); 545 firstPrefix: " $prefix ", prefix: " | ");
548 lines.addAll(childLines.skip(1).map((line) => " | $line")); 546 }).join('\n');
549 } 547 taskString = '$taskString\n$childrenString';
550 } 548 }
551 549
552 return lines.join("\n"); 550 return taskString;
553 }).join("\n"); 551 }).join("\n");
554 } 552 }
555 } 553 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698