Move Various str tests in library

This commit is contained in:
Ayush Kumar Mishra 2020-09-05 17:24:06 +05:30
parent c3364780d2
commit 7d834c87d2
3 changed files with 21 additions and 20 deletions

View File

@ -1921,3 +1921,24 @@ fn different_str_pattern_forwarding_lifetimes() {
foo::<&str>("x");
}
#[test]
fn test_str_multiline() {
let a: String = "this \
is a test"
.to_string();
let b: String = "this \
is \
another \
test"
.to_string();
assert_eq!(a, "this is a test".to_string());
assert_eq!(b, "this is another test".to_string());
}
#[test]
fn test_str_escapes() {
let x = "\\\\\
";
assert_eq!(x, r"\\"); // extraneous whitespace stripped
}

View File

@ -1,13 +0,0 @@
// run-pass
pub fn main() {
let a: String = "this \
is a test".to_string();
let b: String =
"this \
is \
another \
test".to_string();
assert_eq!(a, "this is a test".to_string());
assert_eq!(b, "this is another test".to_string());
}

View File

@ -1,7 +0,0 @@
// run-pass
fn main() {
let x = "\\\\\
";
assert_eq!(x, r"\\"); // extraneous whitespace stripped
}