Tomasz Miąsko 725c11ef3c Add SmallStr
2022-03-04 16:57:34 +01:00

21 lines
449 B
Rust

use super::*;
#[test]
fn empty() {
let s = SmallStr::<1>::new();
assert!(s.empty());
assert_eq!("", s.as_str());
assert!(!s.spilled());
}
#[test]
fn from_iter() {
let s = ["aa", "bb", "cc"].iter().collect::<SmallStr<6>>();
assert_eq!("aabbcc", s.as_str());
assert!(!s.spilled());
let s = ["aa", "bb", "cc", "dd"].iter().collect::<SmallStr<6>>();
assert_eq!("aabbccdd", s.as_str());
assert!(s.spilled());
}