Add test for string AddAssign

This commit is contained in:
Knight 2016-07-27 02:30:50 +08:00
parent 9316ae515e
commit 6ac83de691

View File

@ -192,6 +192,17 @@ fn test_push_str() {
assert_eq!(&s[0..], "abcประเทศไทย中华Việt Nam"); assert_eq!(&s[0..], "abcประเทศไทย中华Việt Nam");
} }
#[test]
fn test_add_assign() {
let mut s = String::new();
s += "";
assert_eq!(s.as_str(), "");
s += "abc";
assert_eq!(s.as_str(), "abc");
s += "ประเทศไทย中华Việt Nam";
assert_eq!(s.as_str(), "abcประเทศไทย中华Việt Nam");
}
#[test] #[test]
fn test_push() { fn test_push() {
let mut data = String::from("ประเทศไทย中"); let mut data = String::from("ประเทศไทย中");