OLD | NEW |
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:io'; | 5 import 'dart:io'; |
6 | 6 |
7 import 'package:boolean_selector/boolean_selector.dart'; | 7 import 'package:boolean_selector/boolean_selector.dart'; |
8 import 'package:collection/collection.dart'; | 8 import 'package:collection/collection.dart'; |
9 import 'package:glob/glob.dart'; | 9 import 'package:glob/glob.dart'; |
10 import 'package:path/path.dart' as p; | 10 import 'package:path/path.dart' as p; |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 int shardIndex, | 273 int shardIndex, |
274 int totalShards, | 274 int totalShards, |
275 Timeout timeout, | 275 Timeout timeout, |
276 Iterable<Pattern> patterns, | 276 Iterable<Pattern> patterns, |
277 Iterable<TestPlatform> platforms, | 277 Iterable<TestPlatform> platforms, |
278 Iterable<String> paths, | 278 Iterable<String> paths, |
279 Glob filename, | 279 Glob filename, |
280 Iterable<String> chosenPresets, | 280 Iterable<String> chosenPresets, |
281 BooleanSelector includeTags, | 281 BooleanSelector includeTags, |
282 BooleanSelector excludeTags, | 282 BooleanSelector excludeTags, |
283 Iterable addTags, | 283 Iterable<String> addTags, |
284 Map<BooleanSelector, Configuration> tags, | 284 Map<BooleanSelector, Configuration> tags, |
285 Map<PlatformSelector, Configuration> onPlatform, | 285 Map<PlatformSelector, Configuration> onPlatform, |
286 Map<String, Configuration> presets}) { | 286 Map<String, Configuration> presets}) { |
287 _unresolved() => new Configuration._( | 287 _unresolved() => new Configuration._( |
288 help: help, | 288 help: help, |
289 version: version, | 289 version: version, |
290 verboseTrace: verboseTrace, | 290 verboseTrace: verboseTrace, |
291 jsTrace: jsTrace, | 291 jsTrace: jsTrace, |
292 skip: skip, | 292 skip: skip, |
293 skipReason: skipReason, | 293 skipReason: skipReason, |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 this.shardIndex, | 367 this.shardIndex, |
368 this.totalShards, | 368 this.totalShards, |
369 Timeout timeout, | 369 Timeout timeout, |
370 Iterable<Pattern> patterns, | 370 Iterable<Pattern> patterns, |
371 Iterable<TestPlatform> platforms, | 371 Iterable<TestPlatform> platforms, |
372 Iterable<String> paths, | 372 Iterable<String> paths, |
373 Glob filename, | 373 Glob filename, |
374 Iterable<String> chosenPresets, | 374 Iterable<String> chosenPresets, |
375 BooleanSelector includeTags, | 375 BooleanSelector includeTags, |
376 BooleanSelector excludeTags, | 376 BooleanSelector excludeTags, |
377 Iterable addTags, | 377 Iterable<String> addTags, |
378 Map<BooleanSelector, Configuration> tags, | 378 Map<BooleanSelector, Configuration> tags, |
379 Map<PlatformSelector, Configuration> onPlatform, | 379 Map<PlatformSelector, Configuration> onPlatform, |
380 Map<String, Configuration> presets}) | 380 Map<String, Configuration> presets}) |
381 : _help = help, | 381 : _help = help, |
382 _version = version, | 382 _version = version, |
383 _verboseTrace = verboseTrace, | 383 _verboseTrace = verboseTrace, |
384 _jsTrace = jsTrace, | 384 _jsTrace = jsTrace, |
385 _skip = skip, | 385 _skip = skip, |
386 testOn = testOn ?? PlatformSelector.all, | 386 testOn = testOn ?? PlatformSelector.all, |
387 _pauseAfterLoad = pauseAfterLoad, | 387 _pauseAfterLoad = pauseAfterLoad, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } else if (shardIndex != null) { | 419 } else if (shardIndex != null) { |
420 RangeError.checkValueInInterval( | 420 RangeError.checkValueInInterval( |
421 shardIndex, 0, totalShards - 1, "shardIndex"); | 421 shardIndex, 0, totalShards - 1, "shardIndex"); |
422 } | 422 } |
423 } | 423 } |
424 | 424 |
425 /// Returns a [input] as an unmodifiable list or `null`. | 425 /// Returns a [input] as an unmodifiable list or `null`. |
426 /// | 426 /// |
427 /// If [input] is `null` or empty, this returns `null`. Otherwise, it returns | 427 /// If [input] is `null` or empty, this returns `null`. Otherwise, it returns |
428 /// `input.toList()`. | 428 /// `input.toList()`. |
429 static List _list(Iterable input) { | 429 static List/*<T>*/ _list/*<T>*/(Iterable/*<T>*/ input) { |
430 if (input == null) return null; | 430 if (input == null) return null; |
431 input = new List.unmodifiable(input); | 431 var list = new List/*<T>*/.unmodifiable(input); |
432 if (input.isEmpty) return null; | 432 if (list.isEmpty) return null; |
433 return input; | 433 return list; |
434 } | 434 } |
435 | 435 |
436 /// Returns an modifiable copy of [input] or an empty unmodifiable map. | 436 /// Returns an unmodifiable copy of [input] or an empty unmodifiable map. |
437 static Map _map(Map input) { | 437 static Map/*<K, V>*/ _map/*<K, V>*/(Map/*<K, V>*/ input) { |
438 if (input == null) return const {}; | 438 if (input == null || input.isEmpty) return const {}; |
439 return new Map.unmodifiable(input); | 439 return new Map.unmodifiable(input); |
440 } | 440 } |
441 | 441 |
442 /// Merges this with [other]. | 442 /// Merges this with [other]. |
443 /// | 443 /// |
444 /// For most fields, if both configurations have values set, [other]'s value | 444 /// For most fields, if both configurations have values set, [other]'s value |
445 /// takes precedence. However, certain fields are merged together instead. | 445 /// takes precedence. However, certain fields are merged together instead. |
446 /// This is indicated in those fields' documentation. | 446 /// This is indicated in those fields' documentation. |
447 Configuration merge(Configuration other) { | 447 Configuration merge(Configuration other) { |
448 if (this == Configuration.empty) return other; | 448 if (this == Configuration.empty) return other; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 int shardIndex, | 504 int shardIndex, |
505 int totalShards, | 505 int totalShards, |
506 Timeout timeout, | 506 Timeout timeout, |
507 Iterable<Pattern> patterns, | 507 Iterable<Pattern> patterns, |
508 Iterable<TestPlatform> platforms, | 508 Iterable<TestPlatform> platforms, |
509 Iterable<String> paths, | 509 Iterable<String> paths, |
510 Glob filename, | 510 Glob filename, |
511 Iterable<String> chosenPresets, | 511 Iterable<String> chosenPresets, |
512 BooleanSelector includeTags, | 512 BooleanSelector includeTags, |
513 BooleanSelector excludeTags, | 513 BooleanSelector excludeTags, |
514 Iterable addTags, | 514 Iterable<String> addTags, |
515 Map<BooleanSelector, Configuration> tags, | 515 Map<BooleanSelector, Configuration> tags, |
516 Map<PlatformSelector, Configuration> onPlatform, | 516 Map<PlatformSelector, Configuration> onPlatform, |
517 Map<String, Configuration> presets}) { | 517 Map<String, Configuration> presets}) { |
518 return new Configuration( | 518 return new Configuration( |
519 help: help ?? _help, | 519 help: help ?? _help, |
520 version: version ?? _version, | 520 version: version ?? _version, |
521 verboseTrace: verboseTrace ?? _verboseTrace, | 521 verboseTrace: verboseTrace ?? _verboseTrace, |
522 jsTrace: jsTrace ?? _jsTrace, | 522 jsTrace: jsTrace ?? _jsTrace, |
523 skip: skip ?? _skip, | 523 skip: skip ?? _skip, |
524 skipReason: skipReason ?? this.skipReason, | 524 skipReason: skipReason ?? this.skipReason, |
(...skipping 22 matching lines...) Expand all Loading... |
547 | 547 |
548 /// Merges two maps whose values are [Configuration]s. | 548 /// Merges two maps whose values are [Configuration]s. |
549 /// | 549 /// |
550 /// Any overlapping keys in the maps have their configurations merged in the | 550 /// Any overlapping keys in the maps have their configurations merged in the |
551 /// returned map. | 551 /// returned map. |
552 Map<Object, Configuration> _mergeConfigMaps(Map<Object, Configuration> map1, | 552 Map<Object, Configuration> _mergeConfigMaps(Map<Object, Configuration> map1, |
553 Map<Object, Configuration> map2) => | 553 Map<Object, Configuration> map2) => |
554 mergeMaps(map1, map2, | 554 mergeMaps(map1, map2, |
555 value: (config1, config2) => config1.merge(config2)); | 555 value: (config1, config2) => config1.merge(config2)); |
556 } | 556 } |
OLD | NEW |