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

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

Issue 12512005: Display which nested tasks are running when an error occurs in a scheduled test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « no previous file | pkg/scheduled_test/lib/src/task.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) 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 'package:unittest/unittest.dart' as unittest; 10 import 'package:unittest/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 'value_future.dart';
16 17
17 /// The schedule of tasks to run for a single test. This has three separate task 18 /// The schedule of tasks to run for a single test. This has three separate task
18 /// queues: [tasks], [onComplete], and [onException]. It also provides 19 /// queues: [tasks], [onComplete], and [onException]. It also provides
19 /// visibility into the current state of the schedule. 20 /// visibility into the current state of the schedule.
20 class Schedule { 21 class Schedule {
21 /// The main task queue for the schedule. These tasks are run before the other 22 /// The main task queue for the schedule. These tasks are run before the other
22 /// queues and generally constitute the main test body. 23 /// queues and generally constitute the main test body.
23 TaskQueue get tasks => _tasks; 24 TaskQueue get tasks => _tasks;
24 TaskQueue _tasks; 25 TaskQueue _tasks;
25 26
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 /// 526 ///
526 /// [highlight] must be a task in this queue. 527 /// [highlight] must be a task in this queue.
527 String generateTree([Task highlight]) { 528 String generateTree([Task highlight]) {
528 assert(highlight == null || highlight.queue == this); 529 assert(highlight == null || highlight.queue == this);
529 return _contents.map((task) { 530 return _contents.map((task) {
530 var lines = task.toString().split("\n"); 531 var lines = task.toString().split("\n");
531 var firstLine = task == highlight ? 532 var firstLine = task == highlight ?
532 "> ${lines.first}" : "* ${lines.first}"; 533 "> ${lines.first}" : "* ${lines.first}";
533 lines = new List.from(lines.skip(1).map((line) => "| $line")); 534 lines = new List.from(lines.skip(1).map((line) => "| $line"));
534 lines.insertRange(0, 1, firstLine); 535 lines.insertRange(0, 1, firstLine);
536
537 if (task == highlight && !task.children.isEmpty) {
538 for (var child in task.children) {
539 var prefix = ">";
540 if (child.state == TaskState.ERROR) {
541 prefix = "X";
542 } else if (child.state == TaskState.SUCCESS) {
543 prefix = "*";
544 }
545
546 var childLines = child.toString().split("\n");
547 lines.add(" $prefix ${childLines.first}");
548 lines.addAll(childLines.skip(1).map((line) => " | $line"));
549 }
550 }
551
535 return lines.join("\n"); 552 return lines.join("\n");
536 }).join("\n"); 553 }).join("\n");
537 } 554 }
538 } 555 }
OLDNEW
« no previous file with comments | « no previous file | pkg/scheduled_test/lib/src/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698