From 6ac83de691c5eb180e2007fcbe3236fd359d2ab7 Mon Sep 17 00:00:00 2001 From: Knight Date: Wed, 27 Jul 2016 02:30:50 +0800 Subject: [PATCH] Add test for string AddAssign --- src/libcollectionstest/string.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libcollectionstest/string.rs b/src/libcollectionstest/string.rs index 7f0fd282ae5e9..1652fb5a88d80 100644 --- a/src/libcollectionstest/string.rs +++ b/src/libcollectionstest/string.rs @@ -192,6 +192,17 @@ fn test_push_str() { 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] fn test_push() { let mut data = String::from("ประเทศไทย中");