Skip to main content

ends_with

Function ends_with 

Source
pub fn ends_with<T>(expected: T) -> StrMatcher<T>
Expand description

Matches a string which ends with the given suffix.

Both the actual value and the expected suffix may be either a String or a string reference.

verify_that!("Some value", ends_with("value"))?;  // Passes
verify_that!("Some value", ends_with("other value"))?;   // Fails
verify_that!("Some value", ends_with("Some"))?;  // Fails
verify_that!("Some value".to_string(), ends_with("value"))?;   // Passes
verify_that!("Some value", ends_with("value".to_string()))?;   // Passes

See the StrMatcherConfigurator extension trait for more options on how the string is matched.