]> git.lizzy.rs Git - rust.git/blob - src/test/ui/lexer-crlf-line-endings-string-literal-doc-comment.rs
Rollup merge of #82259 - osa1:issue82156, r=petrochenkov
[rust.git] / src / test / ui / lexer-crlf-line-endings-string-literal-doc-comment.rs
1 // run-pass\r
2 // ignore-tidy-cr\r
3 // ignore-tidy-cr (repeated again because of tidy bug)\r
4 // license is ignored because tidy can't handle the CRLF here properly.\r
5 \r
6 // N.B., this file needs CRLF line endings. The .gitattributes file in\r
7 // this directory should enforce it.\r
8 \r
9 // ignore-pretty issue #37195\r
10 \r
11 /// Doc comment that ends in CRLF\r
12 pub fn foo() {}\r
13 \r
14 /** Block doc comment that\r
15  *  contains CRLF characters\r
16  */\r
17 pub fn bar() {}\r
18 \r
19 fn main() {\r
20     let s = "string\r
21 literal";\r
22     assert_eq!(s, "string\nliteral");\r
23 \r
24     let s = "literal with \\r
25              escaped newline";\r
26     assert_eq!(s, "literal with escaped newline");\r
27 \r
28     let s = r"string\r
29 literal";\r
30     assert_eq!(s, "string\nliteral");\r
31     let s = br"byte string\r
32 literal";\r
33     assert_eq!(s, "byte string\nliteral".as_bytes());\r
34 \r
35     // validate that our source file has CRLF endings\r
36     let source = include_str!("lexer-crlf-line-endings-string-literal-doc-comment.rs");\r
37     assert!(source.contains("string\r\nliteral"));\r
38 }\r