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