diff options
| author | kennytm <kennytm@gmail.com> | 2018-04-04 11:07:20 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-04-04 11:07:20 +0200 |
| commit | 29ab7d8db02b63464963905612b59a8f745bd2b6 (patch) | |
| tree | c3f9a4d69c6e9952d21b66a756a34342249eb2a0 /src/liballoc/tests | |
| parent | 7dad49f9069b1678aa92959984f9c947308473da (diff) | |
| parent | e75c6a741eded857b2ab06b63ebd3848d9203343 (diff) | |
| download | rust-29ab7d8db02b63464963905612b59a8f745bd2b6.tar.gz rust-29ab7d8db02b63464963905612b59a8f745bd2b6.zip | |
Rollup merge of #49577 - tmccombs:string-splice-stabilize, r=TimNN
Stabilize String::replace_range Fixes #44643
Diffstat (limited to 'src/liballoc/tests')
| -rw-r--r-- | src/liballoc/tests/string.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/src/liballoc/tests/string.rs b/src/liballoc/tests/string.rs index d1e746ea43b..cb4a17a22d8 100644 --- a/src/liballoc/tests/string.rs +++ b/src/liballoc/tests/string.rs @@ -443,53 +443,53 @@ fn test_drain() { } #[test] -fn test_splice() { +fn test_replace_range() { let mut s = "Hello, world!".to_owned(); - s.splice(7..12, "世界"); + s.replace_range(7..12, "世界"); assert_eq!(s, "Hello, 世界!"); } #[test] #[should_panic] -fn test_splice_char_boundary() { +fn test_replace_range_char_boundary() { let mut s = "Hello, 世界!".to_owned(); - s.splice(..8, ""); + s.replace_range(..8, ""); } #[test] -fn test_splice_inclusive_range() { +fn test_replace_range_inclusive_range() { let mut v = String::from("12345"); - v.splice(2..=3, "789"); + v.replace_range(2..=3, "789"); assert_eq!(v, "127895"); - v.splice(1..=2, "A"); + v.replace_range(1..=2, "A"); assert_eq!(v, "1A895"); } #[test] #[should_panic] -fn test_splice_out_of_bounds() { +fn test_replace_range_out_of_bounds() { let mut s = String::from("12345"); - s.splice(5..6, "789"); + s.replace_range(5..6, "789"); } #[test] #[should_panic] -fn test_splice_inclusive_out_of_bounds() { +fn test_replace_range_inclusive_out_of_bounds() { let mut s = String::from("12345"); - s.splice(5..=5, "789"); + s.replace_range(5..=5, "789"); } #[test] -fn test_splice_empty() { +fn test_replace_range_empty() { let mut s = String::from("12345"); - s.splice(1..2, ""); + s.replace_range(1..2, ""); assert_eq!(s, "1345"); } #[test] -fn test_splice_unbounded() { +fn test_replace_range_unbounded() { let mut s = String::from("12345"); - s.splice(.., ""); + s.replace_range(.., ""); assert_eq!(s, ""); } |
