diff options
author | Mikail Bagishov <bagishov.mikail@yandex.ru> | 2020-07-31 22:00:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-31 21:00:23 +0200 |
commit | 8fda719845e5bd90b5222a36155ae559de31a605 (patch) | |
tree | b99698ca21748b1dafa9b295428626782a09643d /tokio/tests | |
parent | 646fbae76535e397ef79dbcaacb945d4c829f666 (diff) |
sync: better Debug for Mutex (#2725)
Diffstat (limited to 'tokio/tests')
-rw-r--r-- | tokio/tests/sync_mutex.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tokio/tests/sync_mutex.rs b/tokio/tests/sync_mutex.rs index 444ebd6a..96194b31 100644 --- a/tokio/tests/sync_mutex.rs +++ b/tokio/tests/sync_mutex.rs @@ -152,3 +152,12 @@ async fn debug_format() { let m = Mutex::new(s.to_string()); assert_eq!(format!("{:?}", s), format!("{:?}", m.lock().await)); } + +#[tokio::test] +async fn mutex_debug() { + let s = "data"; + let m = Mutex::new(s.to_string()); + assert_eq!(format!("{:?}", m), r#"Mutex { data: "data" }"#); + let _guard = m.lock().await; + assert_eq!(format!("{:?}", m), r#"Mutex { data: <locked> }"#) +} |