Move construction tests into a test
diff --git a/src/traits.rs b/src/traits.rs
index 018a62c..6f3462b 100644
--- a/src/traits.rs
+++ b/src/traits.rs
@@ -34,23 +34,3 @@
(self.len_utf8() as u32).into()
}
}
-
-// assertion shape from static_assertions::assert_impl_all!
-const _: fn() = || {
- use std::borrow::Cow;
-
- fn assert_impl<T: TextSized>() {}
-
- assert_impl::<&String>();
- assert_impl::<&Cow<str>>();
-
- struct StringLike {}
- impl Deref for StringLike {
- type Target = str;
- fn deref(&self) -> &str {
- unreachable!()
- }
- }
-
- assert_impl::<&StringLike>();
-};
diff --git a/tests/constructors.rs b/tests/constructors.rs
new file mode 100644
index 0000000..eba587b
--- /dev/null
+++ b/tests/constructors.rs
@@ -0,0 +1,31 @@
+use {
+ std::{borrow::Cow, ops::Deref},
+ text_size::*,
+};
+
+struct StringLike<'a>(&'a str);
+
+impl Deref for StringLike<'_> {
+ type Target = str;
+ fn deref(&self) -> &Self::Target {
+ &self.0
+ }
+}
+
+#[test]
+fn main() {
+ let s = "";
+ let _ = TextSize::of(&s);
+
+ let s = String::new();
+ let _ = TextSize::of(&s);
+
+ let s = Cow::Borrowed("");
+ let _ = TextSize::of(&s);
+
+ let s = Cow::Owned(String::new());
+ let _ = TextSize::of(&s);
+
+ let s = StringLike("");
+ let _ = TextSize::of(&s);
+}