Added str tests in library

This commit is contained in:
Ayush Kumar Mishra 2020-09-05 17:18:45 +05:30
parent c3364780d2
commit 5a0a58bbef
2 changed files with 8 additions and 9 deletions

View File

@ -1921,3 +1921,11 @@ fn different_str_pattern_forwarding_lifetimes() {
foo::<&str>("x");
}
#[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);
}