caramelo 0.1.0

Idiomatic unit test framework for rust
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::fmt::Display;

/// Trait for equality assertions
pub trait Has: Display {
    /// Asserts that the value is equal to the expected value
    fn has(&self, other: &Self) {
        let self_str = self.to_string();
        let other_str = other.to_string();

        if !self_str.contains(&other_str) {
            panic!("Expected {} to contain {}", self, other);
        }
    }
}

impl Has for &str {}
impl Has for String {}