]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/lexer-crlf-line-endings-string-literal-doc-comment.rs
Various minor/cosmetic improvements to code
[rust.git] / src / test / run-pass / lexer-crlf-line-endings-string-literal-doc-comment.rs
1 // ignore-tidy-cr ignore-license\r
2 // ignore-tidy-cr (repeated again because of tidy bug)\r
3 // license is ignored because tidy can't handle the CRLF here properly.\r
4 \r
5 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT\r
6 // file at the top-level directory of this distribution and at\r
7 // http://rust-lang.org/COPYRIGHT.\r
8 //\r
9 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or\r
10 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license\r
11 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your\r
12 // option. This file may not be copied, modified, or distributed\r
13 // except according to those terms.\r
14 \r
15 // N.B., this file needs CRLF line endings. The .gitattributes file in\r
16 // this directory should enforce it.\r
17 \r
18 // ignore-pretty issue #37195\r
19 \r
20 /// Doc comment that ends in CRLF\r
21 pub fn foo() {}\r
22 \r
23 /** Block doc comment that\r
24  *  contains CRLF characters\r
25  */\r
26 pub fn bar() {}\r
27 \r
28 fn main() {\r
29     let s = "string\r
30 literal";\r
31     assert_eq!(s, "string\nliteral");\r
32 \r
33     let s = "literal with \\r
34              escaped newline";\r
35     assert_eq!(s, "literal with escaped newline");\r
36 \r
37     let s = r"string\r
38 literal";\r
39     assert_eq!(s, "string\nliteral");\r
40 \r
41     // validate that our source file has CRLF endings\r
42     let source = include_str!("lexer-crlf-line-endings-string-literal-doc-comment.rs");\r
43     assert!(source.contains("string\r\nliteral"));\r
44 }\r