Auto merge of #76368 - ayushmishra2005:move_str_contact_library, r=jyn514

Added str tests in library

Added str tests in library  as a part of #76268

r? @matklad
This commit is contained in:
bors 2020-09-07 05:20:46 +00:00
commit e114d6228b
2 changed files with 8 additions and 9 deletions

View File

@ -721,3 +721,11 @@ fn test_from_char() {
let s: String = 'x'.into();
assert_eq!(s, 'x'.to_string());
}
#[test]
fn test_str_concat() {
let a: String = "hello".to_string();
let b: String = "world".to_string();
let s: String = format!("{}{}", a, b);
assert_eq!(s.as_bytes()[9], 'd' as u8);
}

View File

@ -1,9 +0,0 @@
// run-pass
pub fn main() {
let a: String = "hello".to_string();
let b: String = "world".to_string();
let s: String = format!("{}{}", a, b);
println!("{}", s.clone());
assert_eq!(s.as_bytes()[9], 'd' as u8);
}