Implement Extend<AsciiChar> for String
This commit is contained in:
parent
73bf7947e9
commit
d566b5db9b
3 changed files with 39 additions and 0 deletions
|
@ -26,3 +26,15 @@ fn test_debug_control() {
|
|||
assert_eq!(want, format!("{chr:?}"), "byte: {byte}");
|
||||
}
|
||||
}
|
||||
|
||||
/// Tests Extend implementation for ascii::Char.
|
||||
#[test]
|
||||
fn test_extend() {
|
||||
let mut s = String::from("abc");
|
||||
s.extend_one(Char::SmallD);
|
||||
assert_eq!(s, String::from("abcd"));
|
||||
|
||||
let mut s = String::from("abc");
|
||||
s.extend(Char::CapitalA..=Char::CapitalC);
|
||||
assert_eq!(s, String::from("abcABC"));
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#![feature(duration_constructors)]
|
||||
#![feature(error_generic_member_access)]
|
||||
#![feature(exact_size_is_empty)]
|
||||
#![feature(extend_one)]
|
||||
#![feature(extern_types)]
|
||||
#![feature(float_minimum_maximum)]
|
||||
#![feature(flt2dec)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue