summary refs log tree commit diff
path: root/src/test/ui/parser
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-03-08 20:08:59 +0100
committerGitHub <noreply@github.com>2021-03-08 20:08:59 +0100
commit5ff52cbdb772e3d4c33428b2b893b8ef015b81ae (patch)
treebbd8433af50737147e8428f16f2634b9041cd3d5 /src/test/ui/parser
parent6e9a94a72b6e4837c9b036267b7c055fd0dea20c (diff)
parentbc1fbf55db9671be7bb04bbf5f68b48f8ee17b2e (diff)
downloadrust-5ff52cbdb772e3d4c33428b2b893b8ef015b81ae.tar.gz
rust-5ff52cbdb772e3d4c33428b2b893b8ef015b81ae.zip
Rollup merge of #82800 - jyn514:group-rustdoc-tests, r=Mark-Simulacrum
Move rustdoc UI tests into a subdirectory

Helps with https://github.com/rust-lang/rust/issues/73494.
Diffstat (limited to 'src/test/ui/parser')
-rw-r--r--src/test/ui/parser/lex-bare-cr-nondoc-comment.rs9
-rw-r--r--src/test/ui/parser/lexer-crlf-line-endings-string-literal-doc-comment.rs38
2 files changed, 47 insertions, 0 deletions
diff --git a/src/test/ui/parser/lex-bare-cr-nondoc-comment.rs b/src/test/ui/parser/lex-bare-cr-nondoc-comment.rs
new file mode 100644
index 00000000000..5b528d6e1e1
--- /dev/null
+++ b/src/test/ui/parser/lex-bare-cr-nondoc-comment.rs
@@ -0,0 +1,9 @@
+// run-pass
+// ignore-tidy-cr
+
+// nondoc comment with bare CR: '
'
+//// nondoc comment with bare CR: '
'
+/* block nondoc comment with bare CR: '
' */
+
+fn main() {
+}
diff --git a/src/test/ui/parser/lexer-crlf-line-endings-string-literal-doc-comment.rs b/src/test/ui/parser/lexer-crlf-line-endings-string-literal-doc-comment.rs
new file mode 100644
index 00000000000..802be7f5afb
--- /dev/null
+++ b/src/test/ui/parser/lexer-crlf-line-endings-string-literal-doc-comment.rs
@@ -0,0 +1,38 @@
+// run-pass

+// ignore-tidy-cr

+// ignore-tidy-cr (repeated again because of tidy bug)

+// license is ignored because tidy can't handle the CRLF here properly.

+

+// N.B., this file needs CRLF line endings. The .gitattributes file in

+// this directory should enforce it.

+

+// ignore-pretty issue #37195

+

+/// Doc comment that ends in CRLF

+pub fn foo() {}

+

+/** Block doc comment that

+ *  contains CRLF characters

+ */

+pub fn bar() {}

+

+fn main() {

+    let s = "string

+literal";

+    assert_eq!(s, "string\nliteral");

+

+    let s = "literal with \

+             escaped newline";

+    assert_eq!(s, "literal with escaped newline");

+

+    let s = r"string

+literal";

+    assert_eq!(s, "string\nliteral");

+    let s = br"byte string

+literal";

+    assert_eq!(s, "byte string\nliteral".as_bytes());

+

+    // validate that our source file has CRLF endings

+    let source = include_str!("lexer-crlf-line-endings-string-literal-doc-comment.rs");

+    assert!(source.contains("string\r\nliteral"));

+}