pub struct TestCaseName(/* private fields */);Expand description
The name of a test case within a binary.
This is the identifier for an individual test within a Rust test binary.
Test case names are typically the full path to the test function, like
module::submodule::test_name.
Implementations§
Source§impl TestCaseName
impl TestCaseName
Sourcepub fn contains(&self, pattern: &str) -> bool
pub fn contains(&self, pattern: &str) -> bool
Returns true if the name contains the given pattern.
Sourcepub fn components(&self) -> Split<'_, &str>
pub fn components(&self) -> Split<'_, &str>
Returns an iterator over the :: separated components of this test case name.
Test case names typically follow Rust’s module path syntax, like
module::submodule::test_name. This method splits on :: to yield each component.
§Examples
use nextest_metadata::TestCaseName;
let name = TestCaseName::new("foo::bar::test_baz");
let components: Vec<_> = name.components().collect();
assert_eq!(components, vec!["foo", "bar", "test_baz"]);
let simple = TestCaseName::new("test_simple");
let components: Vec<_> = simple.components().collect();
assert_eq!(components, vec!["test_simple"]);Sourcepub fn module_path_and_name(&self) -> (Option<&str>, &str)
pub fn module_path_and_name(&self) -> (Option<&str>, &str)
Splits the test case name into a module path prefix and trailing name.
Returns (Some(module_path), name) if the test case name contains ::,
or (None, name) if it doesn’t.
§Examples
use nextest_metadata::TestCaseName;
let name = TestCaseName::new("foo::bar::test_baz");
assert_eq!(name.module_path_and_name(), (Some("foo::bar"), "test_baz"));
let simple = TestCaseName::new("test_simple");
assert_eq!(simple.module_path_and_name(), (None, "test_simple"));Trait Implementations§
Source§impl AsRef<str> for TestCaseName
impl AsRef<str> for TestCaseName
Source§impl Clone for TestCaseName
impl Clone for TestCaseName
Source§fn clone(&self) -> TestCaseName
fn clone(&self) -> TestCaseName
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TestCaseName
impl Debug for TestCaseName
Source§impl<'de> Deserialize<'de> for TestCaseName
impl<'de> Deserialize<'de> for TestCaseName
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for TestCaseName
impl Display for TestCaseName
Source§impl Hash for TestCaseName
impl Hash for TestCaseName
Source§impl Ord for TestCaseName
impl Ord for TestCaseName
Source§fn cmp(&self, other: &TestCaseName) -> Ordering
fn cmp(&self, other: &TestCaseName) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for TestCaseName
impl PartialEq for TestCaseName
Source§impl PartialOrd for TestCaseName
impl PartialOrd for TestCaseName
Source§impl Serialize for TestCaseName
impl Serialize for TestCaseName
impl Eq for TestCaseName
impl StructuralPartialEq for TestCaseName
Auto Trait Implementations§
impl Freeze for TestCaseName
impl RefUnwindSafe for TestCaseName
impl Send for TestCaseName
impl Sync for TestCaseName
impl Unpin for TestCaseName
impl UnwindSafe for TestCaseName
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more