Skip to content
This repository has been archived by the owner on Oct 6, 2020. It is now read-only.

Commit

Permalink
Added Sync+Send tests for AzureError
Browse files Browse the repository at this point in the history
  • Loading branch information
MindFlavor committed May 15, 2020
1 parent 20b1673 commit 4ab4529
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions azure_sdk_core/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,3 +435,46 @@ pub async fn check_status_extract_body_2(
Ok(s)
}
}

#[cfg(test)]
mod test {
use super::*;

fn send_fn<T>(_t: T)
where
T: Send,
{
}

fn sync_fn<T>(_t: T)
where
T: Sync,
{
}

#[test]
fn test_azure_error_send() {
let e = AzureError::HeaderNotFound("Content-Length".to_owned());
send_fn(e);
}

#[test]
fn test_azure_error_sync() {
let e = AzureError::HeaderNotFound("Content-Length".to_owned());
sync_fn(e);
}

// This does not compile
//#[test]
//fn test_not_send() {
// let a = std::rc::Rc::new(100);
// send_fn(a);
//}

// This does not compile
//#[test]
//fn test_not_sync() {
// let a = std::cell::Cell::new(500);
// sync_fn(a);
//}
}

0 comments on commit 4ab4529

Please sign in to comment.