Skip to content

Commit 417ec83

Browse files
authored
Rollup merge of rust-lang#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 rust-lang#76268 r? @matklad
2 parents 80dce98 + 156ff46 commit 417ec83

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

alloc/tests/str.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1921,3 +1921,24 @@ fn different_str_pattern_forwarding_lifetimes() {
19211921

19221922
foo::<&str>("x");
19231923
}
1924+
1925+
#[test]
1926+
fn test_str_multiline() {
1927+
let a: String = "this \
1928+
is a test"
1929+
.to_string();
1930+
let b: String = "this \
1931+
is \
1932+
another \
1933+
test"
1934+
.to_string();
1935+
assert_eq!(a, "this is a test".to_string());
1936+
assert_eq!(b, "this is another test".to_string());
1937+
}
1938+
1939+
#[test]
1940+
fn test_str_escapes() {
1941+
let x = "\\\\\
1942+
";
1943+
assert_eq!(x, r"\\"); // extraneous whitespace stripped
1944+
}

0 commit comments

Comments
 (0)