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

Side by Side Diff: lib/src/backend/group.dart

Issue 1641353002: Expand the JSON reporter to enable a progress bar. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 4 years, 10 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
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 import 'metadata.dart'; 5 import 'metadata.dart';
6 import 'operating_system.dart'; 6 import 'operating_system.dart';
7 import 'group_entry.dart'; 7 import 'group_entry.dart';
8 import 'test.dart'; 8 import 'test.dart';
9 import 'test_platform.dart'; 9 import 'test_platform.dart';
10 10
(...skipping 15 matching lines...) Expand all
26 /// A test to run before all tests in the group. 26 /// A test to run before all tests in the group.
27 /// 27 ///
28 /// This is `null` if no `setUpAll` callbacks were declared. 28 /// This is `null` if no `setUpAll` callbacks were declared.
29 final Test setUpAll; 29 final Test setUpAll;
30 30
31 /// A test to run after all tests in the group. 31 /// A test to run after all tests in the group.
32 /// 32 ///
33 /// This is `null` if no `tearDown` callbacks were declared. 33 /// This is `null` if no `tearDown` callbacks were declared.
34 final Test tearDownAll; 34 final Test tearDownAll;
35 35
36 /// The number of tests (recursively) in this group.
37 int get testCount {
38 if (_testCount != null) return _testCount;
39 _testCount = entries.fold(0,
40 (count, entry) => count + (entry is Group ? entry.testCount : 1));
41 return _testCount;
42 }
43 int _testCount;
44
36 Group(this.name, Iterable<GroupEntry> entries, {Metadata metadata, 45 Group(this.name, Iterable<GroupEntry> entries, {Metadata metadata,
37 Test this.setUpAll, Test this.tearDownAll}) 46 Test this.setUpAll, Test this.tearDownAll})
38 : entries = new List<GroupEntry>.unmodifiable(entries), 47 : entries = new List<GroupEntry>.unmodifiable(entries),
39 metadata = metadata == null ? new Metadata() : metadata; 48 metadata = metadata == null ? new Metadata() : metadata;
40 49
41 Group forPlatform(TestPlatform platform, {OperatingSystem os}) { 50 Group forPlatform(TestPlatform platform, {OperatingSystem os}) {
42 if (!metadata.testOn.evaluate(platform, os: os)) return null; 51 if (!metadata.testOn.evaluate(platform, os: os)) return null;
43 var newMetadata = metadata.forPlatform(platform, os: os); 52 var newMetadata = metadata.forPlatform(platform, os: os);
44 var filtered = _map((entry) => entry.forPlatform(platform, os: os)); 53 var filtered = _map((entry) => entry.forPlatform(platform, os: os));
45 if (filtered.isEmpty && !entries.isEmpty) return null; 54 if (filtered.isEmpty && !entries.isEmpty) return null;
(...skipping 11 matching lines...) Expand all
57 /// Returns the entries of this group mapped using [callback]. 66 /// Returns the entries of this group mapped using [callback].
58 /// 67 ///
59 /// Any `null` values returned by [callback] will be removed. 68 /// Any `null` values returned by [callback] will be removed.
60 List<GroupEntry> _map(GroupEntry callback(GroupEntry entry)) { 69 List<GroupEntry> _map(GroupEntry callback(GroupEntry entry)) {
61 return entries 70 return entries
62 .map((entry) => callback(entry)) 71 .map((entry) => callback(entry))
63 .where((entry) => entry != null) 72 .where((entry) => entry != null)
64 .toList(); 73 .toList();
65 } 74 }
66 } 75 }
OLDNEW
« json_reporter.md ('K') | « json_reporter.schema.json ('k') | lib/src/runner/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698