std.test.Filter
class pub enum Filter
A type describing how to filter out tests.
Constructors
Pattern
Pattern(String)
Only run tests of which the description matches this pattern.
Location
Location(Path)
Only run tests defined in the given file.
None
None()
No filter is applied.
Static methods
from_string
Show source codeHide source code
fn pub static from_string(string: String) -> Filter {
if string.empty? { return Filter.None }
match Path.new(string).expand {
case Ok(path) -> Filter.Location(path)
case _ -> Filter.Pattern(string)
}
}
fn pub static from_string(string: String) -> Filter
Parses a String
into a filter.
If the String
is a valid path, a Location
is returned, if not a
Pattern
is returned.
Instance methods
!=
Show source codeHide source code
fn pub !=(other: T) -> Bool {
(self == other).false?
}
fn pub !=(other: T) -> Bool
Returns true
if self
and the given object are not equal to each other.
==
Show source codeHide source code
fn pub ==(other: ref Filter) -> Bool {
match self {
case Pattern(lhs) -> {
match other {
case Pattern(rhs) -> lhs == rhs
case _ -> false
}
}
case Location(lhs) -> {
match other {
case Location(rhs) -> lhs == rhs
case _ -> false
}
}
case None -> {
match other {
case None -> true
case _ -> false
}
}
}
}
fn pub ==(other: ref Filter) -> Bool
Returns true
if self
and the given object are equal to each other.
This operator is used to perform structural equality. This means two objects residing in different memory locations may be considered equal, provided their structure is equal. For example, two different arrays may be considered to have structural equality if they contain the exact same values.
fmt
Show source codeHide source code
fn pub fmt(formatter: mut Formatter) {
match self {
case Pattern(val) -> formatter.tuple('Pattern').field(val).finish
case Location(path) -> formatter.tuple('Location').field(path).finish
case None -> formatter.tuple('None').finish
}
}
fn pub fmt(formatter: mut Formatter)
Formats self
in a human-readable format for debugging purposes.
Implemented traits
Equal
impl Equal[ref Filter] for Filter
Format
impl Format for Filter