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