Skip to content

Commit cef07e9

Browse files
committed
updated raw string tests
1 parent db0a7d6 commit cef07e9

12 files changed

+124
-25
lines changed
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
11
error: unterminated raw string
2-
--> $DIR/raw-byte-string-eof.rs:2:6
2+
--> $DIR/raw-byte-string-eof.rs:2:5
33
|
44
LL | br##"a"#;
5-
| ^ unterminated raw string
5+
| ^^^^ unterminated raw string
6+
help: Raw string could be meant to end here
67
|
7-
= note: this raw string should be terminated with `"##`
8+
LL | br##"a"##;
9+
| ^^^
10+
help: Raw string could be meant to end here
11+
|
12+
LL | }"##
13+
| ^^^
814

915
error: aborting due to previous error
1016

src/test/ui/parser/raw/raw-byte-string-literals.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ LL | br"é";
55
| ^
66

77
error: found invalid character; only `#` is allowed in raw string delimitation: ~
8-
--> $DIR/raw-byte-string-literals.rs:6:6
8+
--> $DIR/raw-byte-string-literals.rs:6:5
99
|
1010
LL | br##~"a"~##;
11-
| ^^^
11+
| ^^^^
1212

1313
error: aborting due to 2 previous errors
1414

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
fn main() {
2+
let a = r##"This //~ ERROR too many `#` when terminating raw string
3+
is
4+
a
5+
very
6+
long
7+
string
8+
which
9+
goes
10+
over
11+
a
12+
b
13+
c
14+
d
15+
e
16+
f
17+
g
18+
h
19+
lines
20+
"###;
21+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
error: too many `#` when terminating raw string
2+
--> $DIR/raw-literal-too-many-long.rs:2:13
3+
|
4+
LL | let a = r##"This
5+
| ^-- The raw string has 2 leading `#`...
6+
| _____________|
7+
| |
8+
LL | | is
9+
LL | | a
10+
LL | | very
11+
... |
12+
LL | | lines
13+
LL | | "###;
14+
| |______--^
15+
| |
16+
| ...but is closed with 3.
17+
= help: remove the unneeded `#`
18+
19+
error: aborting due to previous error
20+
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
fn main() {
2+
let a = r##"This //~ ERROR unterminated raw string
3+
is
4+
a
5+
very
6+
long
7+
string
8+
which
9+
goes
10+
over
11+
a
12+
b
13+
c
14+
d
15+
e
16+
f
17+
g
18+
h
19+
lines
20+
"#;
21+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: unterminated raw string
2+
--> $DIR/raw-string-long.rs:2:13
3+
|
4+
LL | let a = r##"This
5+
| ^^^ unterminated raw string
6+
help: Raw string could be meant to end here
7+
|
8+
LL | "##;
9+
| ^^^
10+
help: Raw string could be meant to end here
11+
|
12+
LL | }"##
13+
| ^^^
14+
15+
error: aborting due to previous error
16+
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
static s: &'static str =
2-
r#"
3-
"## //~ ERROR expected one of `.`, `;`, `?`, or an operator, found `#`
4-
;
2+
r#" //~ ERROR too many `#` when terminating raw string
3+
"##;
4+
5+
fn main() {}
Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1-
error: expected one of `.`, `;`, `?`, or an operator, found `#`
2-
--> $DIR/raw-str-unbalanced.rs:3:9
1+
error: too many `#` when terminating raw string
2+
--> $DIR/raw-str-unbalanced.rs:2:5
33
|
4-
LL | "##
5-
| ^ expected one of `.`, `;`, `?`, or an operator here
4+
LL | r#"
5+
| ^- The raw string has 1 leading `#`...
6+
| _____|
7+
| |
8+
LL | | "##;
9+
| |________-^
10+
| |
11+
| ...but is closed with 2.
12+
= help: remove the unneeded `#`
613

714
error: aborting due to previous error
815

src/test/ui/parser/raw/raw-str-unterminated.stderr

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ error: unterminated raw string
22
--> $DIR/raw-str-unterminated.rs:2:5
33
|
44
LL | r#" string literal goes on
5-
| ^ unterminated raw string
6-
|
7-
= note: this raw string should be terminated with `"#`
5+
| ^^ unterminated raw string
6+
LL | and on
7+
LL |
8+
| - help: Raw string could be meant to end here: `"#`
89

910
error: aborting due to previous error
1011

src/test/ui/parser/raw/raw-str.stderr

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error: unterminated raw string
2+
--> $DIR/raw_string.rs:2:13
3+
|
4+
LL | let x = r##"lol"#;
5+
| ^^^ unterminated raw string
6+
help: Raw string could be meant to end here
7+
|
8+
LL | let x = r##"lol"##;
9+
| ^^^
10+
help: Raw string could be meant to end here
11+
|
12+
LL | }"##
13+
| ^^^
14+
15+
error: aborting due to previous error
16+

src/test/ui/parser/raw/raw_string.stderr

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)