Rollup merge of #76369 - ayushmishra2005:move_various_str_tests_library, r=jyn514

Move Various str tests in library

Moved various string ui  tests in library  as a part of #76268

r? @matklad
This commit is contained in:
Ralf Jung 2020-09-16 08:24:54 +02:00 committed by GitHub
commit 3a4de42a8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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
}