assert_eq!("Hi, World!", owned);
assert_eq!("Hello, World!", borrowed);
}
+
+#[test]
+fn check_cow_clone_from() {
+ let mut c1: Cow<str> = Cow::Owned(String::with_capacity(25));
+ let s: String = "hi".to_string();
+ assert!(s.capacity() < 25);
+ let c2: Cow<str> = Cow::Owned(s);
+ c1.clone_from(&c2);
+ assert!(c1.into_owned().capacity() >= 25);
+}
\ No newline at end of file