LCOV - code coverage report
Current view: top level - test_api-0.4.8/lib/src/backend - suite.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 4 11 36.4 %
Date: 2021-11-28 14:37:50 Functions: 0 0 -

          Line data    Source code
       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
       3             : // BSD-style license that can be found in the LICENSE file.
       4             : 
       5             : import 'group.dart';
       6             : import 'metadata.dart';
       7             : import 'suite_platform.dart';
       8             : import 'test.dart';
       9             : 
      10             : /// A test suite.
      11             : ///
      12             : /// A test suite is a set of tests that are intended to be run together and that
      13             : /// share default configuration.
      14             : class Suite {
      15             :   /// The platform on which the suite is running.
      16             :   final SuitePlatform platform;
      17             : 
      18             :   /// The path to the Dart test suite, or `null` if that path is unknown.
      19             :   final String? path;
      20             : 
      21             :   /// The metadata associated with this test suite.
      22             :   ///
      23             :   /// This is a shortcut for [group.metadata].
      24           0 :   Metadata get metadata => group.metadata;
      25             : 
      26             :   /// The top-level group for this test suite.
      27             :   final Group group;
      28             : 
      29             :   /// Creates a new suite containing [entires].
      30             :   ///
      31             :   /// If [platform] and/or [os] are passed, [group] is filtered to match that
      32             :   /// platform information.
      33             :   ///
      34             :   /// If [os] is passed without [platform], throws an [ArgumentError].
      35          11 :   Suite(Group group, this.platform, {this.path})
      36          11 :       : group = _filterGroup(group, platform);
      37             : 
      38             :   /// Returns [entries] filtered according to [platform] and [os].
      39             :   ///
      40             :   /// Gracefully handles [platform] being null.
      41          11 :   static Group _filterGroup(Group group, SuitePlatform platform) {
      42          11 :     var filtered = group.forPlatform(platform);
      43             :     if (filtered != null) return filtered;
      44           0 :     return Group.root([], metadata: group.metadata);
      45             :   }
      46             : 
      47             :   /// Returns a new suite with all tests matching [test] removed.
      48             :   ///
      49             :   /// Unlike [GroupEntry.filter], this never returns `null`. If all entries are
      50             :   /// filtered out, it returns an empty suite.
      51           0 :   Suite filter(bool Function(Test) callback) {
      52           0 :     var filtered = group.filter(callback);
      53           0 :     filtered ??= Group.root([], metadata: metadata);
      54           0 :     return Suite(filtered, platform, path: path);
      55             :   }
      56             : 
      57           0 :   bool get isLoadSuite => false;
      58             : }

Generated by: LCOV version 1.14