Skip to content

Commit 156ff46

Browse files
author
Ayush Kumar Mishra
committed
Move Various str tests in library
1 parent dd16f1f commit 156ff46

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)