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

Side by Side Diff: lib/src/runner/loader.dart

Issue 1960503002: Fix all strong-mode errors and warnings. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: .analysis_options Created 4 years, 7 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 | « lib/src/runner/load_suite.dart ('k') | lib/src/runner/parse_metadata.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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:io'; 6 import 'dart:io';
7 7
8 import 'package:analyzer/analyzer.dart' hide Configuration; 8 import 'package:analyzer/analyzer.dart' hide Configuration;
9 import 'package:async/async.dart'; 9 import 'package:async/async.dart';
10 import 'package:path/path.dart' as p; 10 import 'package:path/path.dart' as p;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 /// Registers a [PlatformPlugin] for [platforms]. 69 /// Registers a [PlatformPlugin] for [platforms].
70 /// 70 ///
71 /// When the runner first requests that a suite be loaded for one of the given 71 /// When the runner first requests that a suite be loaded for one of the given
72 /// platforms, this will call [getPlugin] to load the platform plugin. It may 72 /// platforms, this will call [getPlugin] to load the platform plugin. It may
73 /// return either a [PlatformPlugin] or a [Future<PlatformPlugin>]. That 73 /// return either a [PlatformPlugin] or a [Future<PlatformPlugin>]. That
74 /// plugin is then preserved and used to load all suites for all matching 74 /// plugin is then preserved and used to load all suites for all matching
75 /// platforms. 75 /// platforms.
76 /// 76 ///
77 /// This overwrites previous plugins for those platforms. 77 /// This overwrites previous plugins for those platforms.
78 void registerPlatformPlugin(Iterable<TestPlatform> platforms, getPlugin()) { 78 void registerPlatformPlugin(Iterable<TestPlatform> platforms, getPlugin()) {
79 var memoizer = new AsyncMemoizer(); 79 var memoizer = new AsyncMemoizer<PlatformPlugin>();
80 for (var platform in platforms) { 80 for (var platform in platforms) {
81 _platformPlugins[platform] = memoizer; 81 _platformPlugins[platform] = memoizer;
82 _platformCallbacks[platform] = getPlugin; 82 _platformCallbacks[platform] = getPlugin;
83 } 83 }
84 } 84 }
85 85
86 /// Loads all test suites in [dir]. 86 /// Loads all test suites in [dir].
87 /// 87 ///
88 /// This will load tests from files that match the configuration's filename 88 /// This will load tests from files that match the configuration's filename
89 /// glob. Any tests that fail to load will be emitted as [LoadException]s. 89 /// glob. Any tests that fail to load will be emitted as [LoadException]s.
90 /// 90 ///
91 /// This emits [LoadSuite]s that must then be run to emit the actual 91 /// This emits [LoadSuite]s that must then be run to emit the actual
92 /// [RunnerSuite]s defined in the file. 92 /// [RunnerSuite]s defined in the file.
93 Stream<LoadSuite> loadDir(String dir) { 93 Stream<LoadSuite> loadDir(String dir) {
94 return mergeStreams(new Directory(dir).listSync(recursive: true) 94 return StreamGroup.merge(new Directory(dir).listSync(recursive: true)
95 .map((entry) { 95 .map((entry) {
96 if (entry is! File) return new Stream.fromIterable([]); 96 if (entry is! File) return new Stream.fromIterable([]);
97 97
98 if (!_config.filename.matches(p.basename(entry.path))) { 98 if (!_config.filename.matches(p.basename(entry.path))) {
99 return new Stream.fromIterable([]); 99 return new Stream.fromIterable([]);
100 } 100 }
101 101
102 if (p.split(entry.path).contains('packages')) { 102 if (p.split(entry.path).contains('packages')) {
103 return new Stream.fromIterable([]); 103 return new Stream.fromIterable([]);
104 } 104 }
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 })), 181 })),
182 Future.wait(_suites.map((suite) => suite.close())) 182 Future.wait(_suites.map((suite) => suite.close()))
183 ]); 183 ]);
184 184
185 _platformPlugins.clear(); 185 _platformPlugins.clear();
186 _platformCallbacks.clear(); 186 _platformCallbacks.clear();
187 _suites.clear(); 187 _suites.clear();
188 }); 188 });
189 final _closeMemo = new AsyncMemoizer(); 189 final _closeMemo = new AsyncMemoizer();
190 } 190 }
OLDNEW
« no previous file with comments | « lib/src/runner/load_suite.dart ('k') | lib/src/runner/parse_metadata.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698