about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAnton Golov <jesyspa@gmail.com>2021-08-11 12:13:24 +0200
committerAnton Golov <jesyspa@gmail.com>2021-08-11 12:13:24 +0200
commitefe069c599d0d0ed96b8e436bed3850b8ba055ae (patch)
tree21ed3f8a08ffa62bf4a2f2e45f5ab00b26c7d9c3
parent2dff700c4ff3fce32104f614eff8396ef5b0e39a (diff)
downloadrust-efe069c599d0d0ed96b8e436bed3850b8ba055ae.tar.gz
rust-efe069c599d0d0ed96b8e436bed3850b8ba055ae.zip
Add UI tests for string escape warnings.
-rw-r--r--src/test/ui/str/str-escape.rs11
-rw-r--r--src/test/ui/str/str-escape.stderr21
2 files changed, 32 insertions, 0 deletions
diff --git a/src/test/ui/str/str-escape.rs b/src/test/ui/str/str-escape.rs
new file mode 100644
index 00000000000..0264632fd24
--- /dev/null
+++ b/src/test/ui/str/str-escape.rs
@@ -0,0 +1,11 @@
+// check-pass
+fn main() {
+    let s = "\
+
+             ";
+    //~^^^ WARNING multiple lines skipped by escaped newline
+    let s = "foo\
+             bar
+             ";
+    //~^^^ WARNING non-ASCII whitespace symbol '\u{a0}' is not skipped
+}
diff --git a/src/test/ui/str/str-escape.stderr b/src/test/ui/str/str-escape.stderr
new file mode 100644
index 00000000000..b2501f1a214
--- /dev/null
+++ b/src/test/ui/str/str-escape.stderr
@@ -0,0 +1,21 @@
+warning: multiple lines skipped by escaped newline
+  --> $DIR/str-escape.rs:3:14
+   |
+LL |       let s = "\
+   |  ______________^
+LL | |
+LL | |              ";
+   | |_____________^ skipping everything up to and including this point
+
+warning: non-ASCII whitespace symbol '\u{a0}' is not skipped
+  --> $DIR/str-escape.rs:7:17
+   |
+LL |       let s = "foo\
+   |  _________________^
+LL | |              bar
+   | |   ^ non-ASCII whitespace symbol '\u{a0}' is not skipped
+   | |___|
+   | 
+
+warning: 2 warnings emitted
+