diff options
| author | Knight <knight42@mail.ustc.edu.cn> | 2016-07-27 02:30:50 +0800 |
|---|---|---|
| committer | Knight <knight42@mail.ustc.edu.cn> | 2016-07-28 06:08:56 +0800 |
| commit | 6ac83de691c5eb180e2007fcbe3236fd359d2ab7 (patch) | |
| tree | 669e92029d45d1f0deed8c2ae28ddc070f56a276 | |
| parent | 9316ae515e2f8f3f497fb4f1559910c1eef2433d (diff) | |
| download | rust-6ac83de691c5eb180e2007fcbe3236fd359d2ab7.tar.gz rust-6ac83de691c5eb180e2007fcbe3236fd359d2ab7.zip | |
Add test for string AddAssign
| -rw-r--r-- | src/libcollectionstest/string.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/libcollectionstest/string.rs b/src/libcollectionstest/string.rs index 7f0fd282ae5..1652fb5a88d 100644 --- a/src/libcollectionstest/string.rs +++ b/src/libcollectionstest/string.rs @@ -193,6 +193,17 @@ fn test_push_str() { } #[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("ประเทศไทย中"); data.push('华'); |
