Skip to content

Commit 2eb312a

Browse files
bors[bot]matklad
andauthored
Merge #11632
11632: Bring back syntax highlighting in test data r=matklad a=matklad cc #11597 bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
2 parents fc350ea + cf70ed5 commit 2eb312a

File tree

715 files changed

+24858
-48830
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

715 files changed

+24858
-48830
lines changed

crates/parser/src/tests.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ use crate::{LexedStr, TopEntryPoint};
1616
fn lex_ok() {
1717
for case in TestCase::list("lexer/ok") {
1818
let actual = lex(&case.text);
19-
expect_file![case.txt].assert_eq(&actual)
19+
expect_file![case.rast].assert_eq(&actual)
2020
}
2121
}
2222

2323
#[test]
2424
fn lex_err() {
2525
for case in TestCase::list("lexer/err") {
2626
let actual = lex(&case.text);
27-
expect_file![case.txt].assert_eq(&actual)
27+
expect_file![case.rast].assert_eq(&actual)
2828
}
2929
}
3030

@@ -48,7 +48,7 @@ fn parse_ok() {
4848
for case in TestCase::list("parser/ok") {
4949
let (actual, errors) = parse(TopEntryPoint::SourceFile, &case.text);
5050
assert!(!errors, "errors in an OK file {}:\n{}", case.rs.display(), actual);
51-
expect_file![case.txt].assert_eq(&actual);
51+
expect_file![case.rast].assert_eq(&actual);
5252
}
5353
}
5454

@@ -57,7 +57,7 @@ fn parse_inline_ok() {
5757
for case in TestCase::list("parser/inline/ok") {
5858
let (actual, errors) = parse(TopEntryPoint::SourceFile, &case.text);
5959
assert!(!errors, "errors in an OK file {}:\n{}", case.rs.display(), actual);
60-
expect_file![case.txt].assert_eq(&actual);
60+
expect_file![case.rast].assert_eq(&actual);
6161
}
6262
}
6363

@@ -66,7 +66,7 @@ fn parse_err() {
6666
for case in TestCase::list("parser/err") {
6767
let (actual, errors) = parse(TopEntryPoint::SourceFile, &case.text);
6868
assert!(errors, "no errors in an ERR file {}:\n{}", case.rs.display(), actual);
69-
expect_file![case.txt].assert_eq(&actual)
69+
expect_file![case.rast].assert_eq(&actual)
7070
}
7171
}
7272

@@ -75,7 +75,7 @@ fn parse_inline_err() {
7575
for case in TestCase::list("parser/inline/err") {
7676
let (actual, errors) = parse(TopEntryPoint::SourceFile, &case.text);
7777
assert!(errors, "no errors in an ERR file {}:\n{}", case.rs.display(), actual);
78-
expect_file![case.txt].assert_eq(&actual)
78+
expect_file![case.rast].assert_eq(&actual)
7979
}
8080
}
8181

@@ -137,7 +137,7 @@ fn parse(entry: TopEntryPoint, text: &str) -> (String, bool) {
137137
#[derive(PartialEq, Eq, PartialOrd, Ord)]
138138
struct TestCase {
139139
rs: PathBuf,
140-
txt: PathBuf,
140+
rast: PathBuf,
141141
text: String,
142142
}
143143

@@ -155,9 +155,9 @@ impl TestCase {
155155
let path = file.path();
156156
if path.extension().unwrap_or_default() == "rs" {
157157
let rs = path;
158-
let txt = rs.with_extension("txt");
158+
let rast = rs.with_extension("rast");
159159
let text = fs::read_to_string(&rs).unwrap();
160-
res.push(TestCase { rs, txt, text });
160+
res.push(TestCase { rs, rast, text });
161161
}
162162
}
163163
res.sort();
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
FLOAT_NUMBER "0e" error: Missing digits after the exponent symbol
2+
WHITESPACE "\n"
3+
FLOAT_NUMBER "0E" error: Missing digits after the exponent symbol
4+
WHITESPACE "\n\n"
5+
FLOAT_NUMBER "42e+" error: Missing digits after the exponent symbol
6+
WHITESPACE "\n"
7+
FLOAT_NUMBER "42e-" error: Missing digits after the exponent symbol
8+
WHITESPACE "\n"
9+
FLOAT_NUMBER "42E+" error: Missing digits after the exponent symbol
10+
WHITESPACE "\n"
11+
FLOAT_NUMBER "42E-" error: Missing digits after the exponent symbol
12+
WHITESPACE "\n\n"
13+
INT_NUMBER "42"
14+
DOT "."
15+
IDENT "e"
16+
PLUS "+"
17+
WHITESPACE "\n"
18+
INT_NUMBER "42"
19+
DOT "."
20+
IDENT "e"
21+
MINUS "-"
22+
WHITESPACE "\n"
23+
INT_NUMBER "42"
24+
DOT "."
25+
IDENT "E"
26+
PLUS "+"
27+
WHITESPACE "\n"
28+
INT_NUMBER "42"
29+
DOT "."
30+
IDENT "E"
31+
MINUS "-"
32+
WHITESPACE "\n\n"
33+
FLOAT_NUMBER "42.2e+" error: Missing digits after the exponent symbol
34+
WHITESPACE "\n"
35+
FLOAT_NUMBER "42.2e-" error: Missing digits after the exponent symbol
36+
WHITESPACE "\n"
37+
FLOAT_NUMBER "42.2E+" error: Missing digits after the exponent symbol
38+
WHITESPACE "\n"
39+
FLOAT_NUMBER "42.2E-" error: Missing digits after the exponent symbol
40+
WHITESPACE "\n\n"
41+
FLOAT_NUMBER "42.2e+f32" error: Missing digits after the exponent symbol
42+
WHITESPACE "\n"
43+
FLOAT_NUMBER "42.2e-f32" error: Missing digits after the exponent symbol
44+
WHITESPACE "\n"
45+
FLOAT_NUMBER "42.2E+f32" error: Missing digits after the exponent symbol
46+
WHITESPACE "\n"
47+
FLOAT_NUMBER "42.2E-f32" error: Missing digits after the exponent symbol
48+
WHITESPACE "\n"
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
INT_NUMBER "0b" error: Missing digits after the integer base prefix
2+
WHITESPACE "\n"
3+
INT_NUMBER "0o" error: Missing digits after the integer base prefix
4+
WHITESPACE "\n"
5+
INT_NUMBER "0x" error: Missing digits after the integer base prefix
6+
WHITESPACE "\n\n"
7+
INT_NUMBER "0b_" error: Missing digits after the integer base prefix
8+
WHITESPACE "\n"
9+
INT_NUMBER "0o_" error: Missing digits after the integer base prefix
10+
WHITESPACE "\n"
11+
INT_NUMBER "0x_" error: Missing digits after the integer base prefix
12+
WHITESPACE "\n\n"
13+
INT_NUMBER "0bnoDigit" error: Missing digits after the integer base prefix
14+
WHITESPACE "\n"
15+
INT_NUMBER "0onoDigit" error: Missing digits after the integer base prefix
16+
WHITESPACE "\n"
17+
INT_NUMBER "0xnoDigit" error: Missing digits after the integer base prefix
18+
WHITESPACE "\n\n"
19+
INT_NUMBER "0xG" error: Missing digits after the integer base prefix
20+
WHITESPACE "\n"
21+
INT_NUMBER "0xg" error: Missing digits after the integer base prefix
22+
WHITESPACE "\n\n"
23+
INT_NUMBER "0x_g" error: Missing digits after the integer base prefix
24+
WHITESPACE "\n"
25+
INT_NUMBER "0x_G" error: Missing digits after the integer base prefix
26+
WHITESPACE "\n"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
LIFETIME_IDENT "'1" error: Lifetime name cannot start with a number
2+
WHITESPACE "\n"
3+
LIFETIME_IDENT "'1lifetime" error: Lifetime name cannot start with a number
4+
WHITESPACE "\n"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COMMENT "/*" error: Missing trailing `*/` symbols to terminate the block comment
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COMMENT "/* comment\n" error: Missing trailing `*/` symbols to terminate the block comment
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE "b'" error: Missing trailing `'` symbol to terminate the byte literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "b\"" error: Missing trailing `"` symbol to terminate the byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "b\"\\x7f" error: Missing trailing `"` symbol to terminate the byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "b\"🦀" error: Missing trailing `"` symbol to terminate the byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "b\"\\" error: Missing trailing `"` symbol to terminate the byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "b\"\\\"" error: Missing trailing `"` symbol to terminate the byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "b\"\\n" error: Missing trailing `"` symbol to terminate the byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "b\" " error: Missing trailing `"` symbol to terminate the byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "b\"\\u{20AA}" error: Missing trailing `"` symbol to terminate the byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE "b'\\x7f" error: Missing trailing `'` symbol to terminate the byte literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE "b'🦀" error: Missing trailing `'` symbol to terminate the byte literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE "b'\\" error: Missing trailing `'` symbol to terminate the byte literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE "b'\\n" error: Missing trailing `'` symbol to terminate the byte literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE "b'\\'" error: Missing trailing `'` symbol to terminate the byte literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE "b' " error: Missing trailing `'` symbol to terminate the byte literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE "b'\\u{20AA}" error: Missing trailing `'` symbol to terminate the byte literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHAR "'" error: Missing trailing `'` symbol to terminate the character literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHAR "'\\x7f" error: Missing trailing `'` symbol to terminate the character literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHAR "'🦀" error: Missing trailing `'` symbol to terminate the character literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHAR "'\\" error: Missing trailing `'` symbol to terminate the character literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHAR "'\\n" error: Missing trailing `'` symbol to terminate the character literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHAR "'\\'" error: Missing trailing `'` symbol to terminate the character literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHAR "' " error: Missing trailing `'` symbol to terminate the character literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CHAR "'\\u{20AA}" error: Missing trailing `'` symbol to terminate the character literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COMMENT "/* /* /*\n" error: Missing trailing `*/` symbols to terminate the block comment
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COMMENT "/** /*! /* comment */ */\n" error: Missing trailing `*/` symbols to terminate the block comment
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "br##\"" error: Missing trailing `"` with `#` symbols to terminate the raw byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "br##\"\\x7f" error: Missing trailing `"` with `#` symbols to terminate the raw byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "br##\"🦀" error: Missing trailing `"` with `#` symbols to terminate the raw byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "br##\"\\" error: Missing trailing `"` with `#` symbols to terminate the raw byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "br##\"\\n" error: Missing trailing `"` with `#` symbols to terminate the raw byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "br##\" " error: Missing trailing `"` with `#` symbols to terminate the raw byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "br##\"\\u{20AA}" error: Missing trailing `"` with `#` symbols to terminate the raw byte string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "r##\"" error: Missing trailing `"` with `#` symbols to terminate the raw string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "r##\"\\x7f" error: Missing trailing `"` with `#` symbols to terminate the raw string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "r##\"🦀" error: Missing trailing `"` with `#` symbols to terminate the raw string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "r##\"\\" error: Missing trailing `"` with `#` symbols to terminate the raw string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "r##\"\\n" error: Missing trailing `"` with `#` symbols to terminate the raw string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "r##\" " error: Missing trailing `"` with `#` symbols to terminate the raw string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "r##\"\\u{20AA}" error: Missing trailing `"` with `#` symbols to terminate the raw string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "\"" error: Missing trailing `"` symbol to terminate the string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "\"\\x7f" error: Missing trailing `"` symbol to terminate the string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "\"🦀" error: Missing trailing `"` symbol to terminate the string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "\"\\" error: Missing trailing `"` symbol to terminate the string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "\"\\\"" error: Missing trailing `"` symbol to terminate the string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "\"\\n" error: Missing trailing `"` symbol to terminate the string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "\" " error: Missing trailing `"` symbol to terminate the string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "\"\\u{20AA}" error: Missing trailing `"` symbol to terminate the string literal
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
BYTE_STRING "br##" error: Missing `"` symbol after `#` symbols to begin the raw byte string literal
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
BYTE_STRING "br## " error: Missing `"` symbol after `#` symbols to begin the raw byte string literal
2+
IDENT "I"
3+
WHITESPACE " "
4+
IDENT "lack"
5+
WHITESPACE " "
6+
IDENT "a"
7+
WHITESPACE " "
8+
IDENT "quote"
9+
BANG "!"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
STRING "r##" error: Missing `"` symbol after `#` symbols to begin the raw string literal
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
STRING "r## " error: Missing `"` symbol after `#` symbols to begin the raw string literal
2+
IDENT "I"
3+
WHITESPACE " "
4+
IDENT "lack"
5+
WHITESPACE " "
6+
IDENT "a"
7+
WHITESPACE " "
8+
IDENT "quote"
9+
BANG "!"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
COMMENT "/* */"
2+
WHITESPACE "\n"
3+
COMMENT "/**/"
4+
WHITESPACE "\n"
5+
COMMENT "/* /* */ */"
6+
WHITESPACE "\n"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
BYTE "b''"
2+
WHITESPACE " "
3+
BYTE "b'x'"
4+
WHITESPACE " "
5+
BYTE_STRING "b\"foo\""
6+
WHITESPACE " "
7+
BYTE_STRING "br\"\""
8+
WHITESPACE "\n"
9+
BYTE "b''suf"
10+
WHITESPACE " "
11+
BYTE_STRING "b\"\"ix"
12+
WHITESPACE " "
13+
BYTE_STRING "br\"\"br"
14+
WHITESPACE "\n"
15+
BYTE "b'\\n'"
16+
WHITESPACE " "
17+
BYTE "b'\\\\'"
18+
WHITESPACE " "
19+
BYTE "b'\\''"
20+
WHITESPACE " "
21+
BYTE "b'hello'"
22+
WHITESPACE "\n"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
CHAR "'x'"
2+
WHITESPACE " "
3+
CHAR "' '"
4+
WHITESPACE " "
5+
CHAR "'0'"
6+
WHITESPACE " "
7+
CHAR "'hello'"
8+
WHITESPACE " "
9+
CHAR "'\\x7f'"
10+
WHITESPACE " "
11+
CHAR "'\\n'"
12+
WHITESPACE " "
13+
CHAR "'\\\\'"
14+
WHITESPACE " "
15+
CHAR "'\\''"
16+
WHITESPACE "\n"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
IDENT "hello"
2+
WHITESPACE " "
3+
IDENT "world"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
IDENT "foo"
2+
WHITESPACE " "
3+
IDENT "foo_"
4+
WHITESPACE " "
5+
IDENT "_foo"
6+
WHITESPACE " "
7+
UNDERSCORE "_"
8+
WHITESPACE " "
9+
IDENT "__"
10+
WHITESPACE " "
11+
IDENT "x"
12+
WHITESPACE " "
13+
IDENT "привет"
14+
WHITESPACE "\n"

0 commit comments

Comments
 (0)