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

Side by Side Diff: lib/src/runner.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/frontend/timeout.dart ('k') | lib/src/runner/browser/browser_manager.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:async/async.dart'; 8 import 'package:async/async.dart';
9 9
10 import 'backend/group.dart'; 10 import 'backend/group.dart';
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 ]); 225 ]);
226 if (timer != null) timer.cancel(); 226 if (timer != null) timer.cancel();
227 await _loader.close(); 227 await _loader.close();
228 }); 228 });
229 229
230 /// Return a stream of [LoadSuite]s in [_config.paths]. 230 /// Return a stream of [LoadSuite]s in [_config.paths].
231 /// 231 ///
232 /// Only tests that match [_config.patterns] will be included in the 232 /// Only tests that match [_config.patterns] will be included in the
233 /// suites once they're loaded. 233 /// suites once they're loaded.
234 Stream<LoadSuite> _loadSuites() { 234 Stream<LoadSuite> _loadSuites() {
235 return mergeStreams(_config.paths.map((path) { 235 return StreamGroup.merge(_config.paths.map((path) {
236 if (new Directory(path).existsSync()) return _loader.loadDir(path); 236 if (new Directory(path).existsSync()) return _loader.loadDir(path);
237 if (new File(path).existsSync()) return _loader.loadFile(path); 237 if (new File(path).existsSync()) return _loader.loadFile(path);
238 238
239 return new Stream.fromIterable([ 239 return new Stream.fromIterable([
240 new LoadSuite.forLoadException( 240 new LoadSuite.forLoadException(
241 new LoadException(path, 'Does not exist.')) 241 new LoadException(path, 'Does not exist.'))
242 ]); 242 ]);
243 })).map((loadSuite) { 243 })).map((loadSuite) {
244 return loadSuite.changeSuite((suite) { 244 return loadSuite.changeSuite((suite) {
245 _warnForUnknownTags(suite); 245 _warnForUnknownTags(suite);
246 246
247 return _shardSuite(suite.filter((test) { 247 return _shardSuite(suite.filter((test) {
248 // Skip any tests that don't match all the given patterns. 248 // Skip any tests that don't match all the given patterns.
249 if (!_config.patterns.every(test.name.contains)) { 249 if (!_config.patterns
250 .every((pattern) => test.name.contains(pattern))) {
250 return false; 251 return false;
251 } 252 }
252 253
253 // If the user provided tags, skip tests that don't match all of them. 254 // If the user provided tags, skip tests that don't match all of them.
254 if (!_config.includeTags.evaluate(test.metadata.tags)) return false; 255 if (!_config.includeTags.evaluate(test.metadata.tags)) return false;
255 256
256 // Skip tests that do match any tags the user wants to exclude. 257 // Skip tests that do match any tags the user wants to exclude.
257 if (_config.excludeTags.evaluate(test.metadata.tags)) return false; 258 if (_config.excludeTags.evaluate(test.metadata.tags)) return false;
258 259
259 return true; 260 return true;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 }); 299 });
299 300
300 print(buffer.toString()); 301 print(buffer.toString());
301 } 302 }
302 303
303 /// Collects all tags used by [suite] or its children that aren't also passed 304 /// Collects all tags used by [suite] or its children that aren't also passed
304 /// on the command line. 305 /// on the command line.
305 /// 306 ///
306 /// This returns a map from tag names to lists of entries that use those tags. 307 /// This returns a map from tag names to lists of entries that use those tags.
307 Map<String, List<GroupEntry>> _collectUnknownTags(Suite suite) { 308 Map<String, List<GroupEntry>> _collectUnknownTags(Suite suite) {
308 var unknownTags = {}; 309 var unknownTags = <String, List<GroupEntry>>{};
309 var currentTags = new Set(); 310 var currentTags = new Set<String>();
310 311
311 collect(entry) { 312 collect(entry) {
312 var newTags = new Set(); 313 var newTags = new Set<String>();
313 for (var unknownTag in 314 for (var unknownTag in
314 entry.metadata.tags.difference(_config.knownTags)) { 315 entry.metadata.tags.difference(_config.knownTags)) {
315 if (currentTags.contains(unknownTag)) continue; 316 if (currentTags.contains(unknownTag)) continue;
316 unknownTags.putIfAbsent(unknownTag, () => []).add(entry); 317 unknownTags.putIfAbsent(unknownTag, () => []).add(entry);
317 newTags.add(unknownTag); 318 newTags.add(unknownTag);
318 } 319 }
319 320
320 if (entry is! Group) return; 321 if (entry is! Group) return;
321 322
322 currentTags.addAll(newTags); 323 currentTags.addAll(newTags);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 await _debugOperation.valueOrCancellation(); 374 await _debugOperation.valueOrCancellation();
374 }).listen(null); 375 }).listen(null);
375 376
376 var results = await Future.wait([ 377 var results = await Future.wait([
377 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()), 378 _suiteSubscription.asFuture().then((_) => _engine.suiteSink.close()),
378 _engine.run() 379 _engine.run()
379 ]); 380 ]);
380 return results.last; 381 return results.last;
381 } 382 }
382 } 383 }
OLDNEW
« no previous file with comments | « lib/src/frontend/timeout.dart ('k') | lib/src/runner/browser/browser_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698