From c57aa22db84ebb459008bc17c2c394d9f7caac90 Mon Sep 17 00:00:00 2001 From: Jason Lee Date: Mon, 22 Jan 2024 19:00:33 +0800 Subject: [PATCH] Update atomic_str.rs --- crates/support/src/atomic_str.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/support/src/atomic_str.rs b/crates/support/src/atomic_str.rs index 0dd0249..ebe5636 100644 --- a/crates/support/src/atomic_str.rs +++ b/crates/support/src/atomic_str.rs @@ -48,3 +48,18 @@ impl fmt::Display for AtomicStr { f.write_str(&self.as_str()) } } + +#[cfg(test)] +mod tests { + use super::*; + + fn test_str(s: &str) { + assert_eq!(s, "hello"); + } + + #[test] + fn test_atomic_str() { + let s = AtomicStr::from("hello"); + test_str(&s.as_str()); + } +}