Attribute Macro test_with::tcp

source · []
#[tcp]
Expand description

Run test case when socket connected

#[cfg(test)]
mod tests {

    // Google DNS is online
    #[test_with::tcp(8.8.8.8:53)]
    #[test]
    fn test_works() {
        assert!(true);
    }

    // 193.194.195.196 is offline
    #[test_with::tcp(193.194.195.196)]
    #[test]
    fn test_ignored() {
        panic!("should be ignored")
    }
}