Skip to content
This repository was archived by the owner on Nov 24, 2023. It is now read-only.

Commit b5e4e61

Browse files
authored
Merge pull request #96 from killercup/refactor-rustfix-tests
Refactor rustfix tests
2 parents a646d16 + 8ed4006 commit b5e4e61

17 files changed

+261
-178
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ log = "0.4.1"
2727
duct = "0.8.2"
2828
env_logger = "0.5.0-rc.1"
2929
log = "0.4.1"
30-
pretty_assertions = "0.4.1"
3130
tempdir = "0.3.5"
3231
proptest = "0.7.0"
32+
difference = "2.0.0"
3333

3434
[workspace]
3535
members = [
File renamed without changes.

tests/everything.rs

-158
This file was deleted.

tests/everything/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*.recorded.json
2+
*.recorded.rs
File renamed without changes.

tests/fixtures/E0178.json renamed to tests/everything/E0178.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"level": "error",
88
"spans": [
99
{
10-
"file_name": "./tests/fixtures/E0178.rs",
10+
"file_name": "./tests/everything/E0178.rs",
1111
"byte_start": 60,
1212
"byte_end": 74,
1313
"line_start": 6,
@@ -34,7 +34,7 @@
3434
"level": "help",
3535
"spans": [
3636
{
37-
"file_name": "./tests/fixtures/E0178.rs",
37+
"file_name": "./tests/everything/E0178.rs",
3838
"byte_start": 60,
3939
"byte_end": 74,
4040
"line_start": 6,
@@ -58,7 +58,7 @@
5858
"rendered": null
5959
}
6060
],
61-
"rendered": "error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo`\n --> ./tests/fixtures/E0178.rs:6:8\n |\n6 | w: &'a Foo + Send,\n | ^^^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + Send)`\n\nIf you want more information on this error, try using \"rustc --explain E0178\"\n"
61+
"rendered": "error[E0178]: expected a path on the left-hand side of `+`, not `&'a Foo`\n --> ./tests/everything/E0178.rs:6:8\n |\n6 | w: &'a Foo + Send,\n | ^^^^^^^^^^^^^^ help: try adding parentheses: `&'a (Foo + Send)`\n\nIf you want more information on this error, try using \"rustc --explain E0178\"\n"
6262
}
6363
{
6464
"message": "aborting due to previous error",
File renamed without changes.

tests/fixtures/closure-immutable-outer-variable.json renamed to tests/everything/closure-immutable-outer-variable.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"level": "error",
88
"spans": [
99
{
10-
"file_name": "./tests/fixtures/closure-immutable-outer-variable.rs",
10+
"file_name": "./tests/everything/closure-immutable-outer-variable.rs",
1111
"byte_start": 615,
1212
"byte_end": 624,
1313
"line_start": 19,
@@ -34,7 +34,7 @@
3434
"level": "help",
3535
"spans": [
3636
{
37-
"file_name": "./tests/fixtures/closure-immutable-outer-variable.rs",
37+
"file_name": "./tests/everything/closure-immutable-outer-variable.rs",
3838
"byte_start": 580,
3939
"byte_end": 581,
4040
"line_start": 18,
@@ -58,7 +58,7 @@
5858
"rendered": null
5959
}
6060
],
61-
"rendered": "error[E0594]: cannot assign to captured outer variable in an `FnMut` closure\n --> ./tests/fixtures/closure-immutable-outer-variable.rs:19:26\n |\n18 | let y = true;\n | - help: consider making `y` mutable: `mut y`\n19 | foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable\n | ^^^^^^^^^\n\nIf you want more information on this error, try using \"rustc --explain E0594\"\n"
61+
"rendered": "error[E0594]: cannot assign to captured outer variable in an `FnMut` closure\n --> ./tests/everything/closure-immutable-outer-variable.rs:19:26\n |\n18 | let y = true;\n | - help: consider making `y` mutable: `mut y`\n19 | foo(Box::new(move || y = false) as Box<_>); //~ ERROR cannot assign to captured outer variable\n | ^^^^^^^^^\n\nIf you want more information on this error, try using \"rustc --explain E0594\"\n"
6262
}
6363
{
6464
"message": "aborting due to previous error",

tests/fixtures/lt-generic-comp.json renamed to tests/everything/lt-generic-comp.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"level": "error",
55
"spans": [
66
{
7-
"file_name": "./tests/fixtures/lt-generic-comp.rs",
7+
"file_name": "./tests/everything/lt-generic-comp.rs",
88
"byte_start": 49,
99
"byte_end": 50,
1010
"line_start": 4,
@@ -24,7 +24,7 @@
2424
"expansion": null
2525
},
2626
{
27-
"file_name": "./tests/fixtures/lt-generic-comp.rs",
27+
"file_name": "./tests/everything/lt-generic-comp.rs",
2828
"byte_start": 47,
2929
"byte_end": 48,
3030
"line_start": 4,
@@ -51,7 +51,7 @@
5151
"level": "help",
5252
"spans": [
5353
{
54-
"file_name": "./tests/fixtures/lt-generic-comp.rs",
54+
"file_name": "./tests/everything/lt-generic-comp.rs",
5555
"byte_start": 38,
5656
"byte_end": 46,
5757
"line_start": 4,
@@ -75,7 +75,7 @@
7575
"rendered": null
7676
}
7777
],
78-
"rendered": "error: `<` is interpreted as a start of generic arguments for `u32`, not a comparison\n --> ./tests/fixtures/lt-generic-comp.rs:4:17\n |\n4 | if x as u32 < 4 {\n | -------- ^ - interpreted as generic arguments\n | | |\n | | not interpreted as comparison\n | help: try comparing the cast value: `(x as u32)`\n\n"
78+
"rendered": "error: `<` is interpreted as a start of generic arguments for `u32`, not a comparison\n --> ./tests/everything/lt-generic-comp.rs:4:17\n |\n4 | if x as u32 < 4 {\n | -------- ^ - interpreted as generic arguments\n | | |\n | | not interpreted as comparison\n | help: try comparing the cast value: `(x as u32)`\n\n"
7979
}
8080
{
8181
"message": "aborting due to previous error",

tests/fixtures/str-lit-type-mismatch.json renamed to tests/everything/str-lit-type-mismatch.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"level": "error",
88
"spans": [
99
{
10-
"file_name": "./tests/fixtures/str-lit-type-mismatch.rs",
10+
"file_name": "./tests/everything/str-lit-type-mismatch.rs",
1111
"byte_start": 499,
1212
"byte_end": 504,
1313
"line_start": 13,
@@ -42,7 +42,7 @@
4242
"level": "help",
4343
"spans": [
4444
{
45-
"file_name": "./tests/fixtures/str-lit-type-mismatch.rs",
45+
"file_name": "./tests/everything/str-lit-type-mismatch.rs",
4646
"byte_start": 499,
4747
"byte_end": 504,
4848
"line_start": 13,
@@ -66,7 +66,7 @@
6666
"rendered": null
6767
}
6868
],
69-
"rendered": "error[E0308]: mismatched types\n --> ./tests/fixtures/str-lit-type-mismatch.rs:13:20\n |\n13 | let x: &[u8] = \"foo\"; //~ ERROR mismatched types\n | ^^^^^\n | |\n | expected slice, found str\n | help: consider adding a leading `b`: `b\"foo\"`\n |\n = note: expected type `&[u8]`\n found type `&'static str`\n\nIf you want more information on this error, try using \"rustc --explain E0308\"\n"
69+
"rendered": "error[E0308]: mismatched types\n --> ./tests/everything/str-lit-type-mismatch.rs:13:20\n |\n13 | let x: &[u8] = \"foo\"; //~ ERROR mismatched types\n | ^^^^^\n | |\n | expected slice, found str\n | help: consider adding a leading `b`: `b\"foo\"`\n |\n = note: expected type `&[u8]`\n found type `&'static str`\n\nIf you want more information on this error, try using \"rustc --explain E0308\"\n"
7070
}
7171
{
7272
"message": "mismatched types",
@@ -77,7 +77,7 @@
7777
"level": "error",
7878
"spans": [
7979
{
80-
"file_name": "./tests/fixtures/str-lit-type-mismatch.rs",
80+
"file_name": "./tests/everything/str-lit-type-mismatch.rs",
8181
"byte_start": 555,
8282
"byte_end": 561,
8383
"line_start": 14,
@@ -112,7 +112,7 @@
112112
"level": "help",
113113
"spans": [
114114
{
115-
"file_name": "./tests/fixtures/str-lit-type-mismatch.rs",
115+
"file_name": "./tests/everything/str-lit-type-mismatch.rs",
116116
"byte_start": 555,
117117
"byte_end": 561,
118118
"line_start": 14,
@@ -136,7 +136,7 @@
136136
"rendered": null
137137
}
138138
],
139-
"rendered": "error[E0308]: mismatched types\n --> ./tests/fixtures/str-lit-type-mismatch.rs:14:23\n |\n14 | let y: &[u8; 4] = \"baaa\"; //~ ERROR mismatched types\n | ^^^^^^\n | |\n | expected array of 4 elements, found str\n | help: consider adding a leading `b`: `b\"baaa\"`\n |\n = note: expected type `&[u8; 4]`\n found type `&'static str`\n\nIf you want more information on this error, try using \"rustc --explain E0308\"\n"
139+
"rendered": "error[E0308]: mismatched types\n --> ./tests/everything/str-lit-type-mismatch.rs:14:23\n |\n14 | let y: &[u8; 4] = \"baaa\"; //~ ERROR mismatched types\n | ^^^^^^\n | |\n | expected array of 4 elements, found str\n | help: consider adding a leading `b`: `b\"baaa\"`\n |\n = note: expected type `&[u8; 4]`\n found type `&'static str`\n\nIf you want more information on this error, try using \"rustc --explain E0308\"\n"
140140
}
141141
{
142142
"message": "mismatched types",
@@ -147,7 +147,7 @@
147147
"level": "error",
148148
"spans": [
149149
{
150-
"file_name": "./tests/fixtures/str-lit-type-mismatch.rs",
150+
"file_name": "./tests/everything/str-lit-type-mismatch.rs",
151151
"byte_start": 608,
152152
"byte_end": 614,
153153
"line_start": 15,
@@ -182,7 +182,7 @@
182182
"level": "help",
183183
"spans": [
184184
{
185-
"file_name": "./tests/fixtures/str-lit-type-mismatch.rs",
185+
"file_name": "./tests/everything/str-lit-type-mismatch.rs",
186186
"byte_start": 608,
187187
"byte_end": 614,
188188
"line_start": 15,
@@ -206,7 +206,7 @@
206206
"rendered": null
207207
}
208208
],
209-
"rendered": "error[E0308]: mismatched types\n --> ./tests/fixtures/str-lit-type-mismatch.rs:15:19\n |\n15 | let z: &str = b\"foo\"; //~ ERROR mismatched types\n | ^^^^^^\n | |\n | expected str, found array of 3 elements\n | help: consider removing the leading `b`: `\"foo\"`\n |\n = note: expected type `&str`\n found type `&'static [u8; 3]`\n\nIf you want more information on this error, try using \"rustc --explain E0308\"\n"
209+
"rendered": "error[E0308]: mismatched types\n --> ./tests/everything/str-lit-type-mismatch.rs:15:19\n |\n15 | let z: &str = b\"foo\"; //~ ERROR mismatched types\n | ^^^^^^\n | |\n | expected str, found array of 3 elements\n | help: consider removing the leading `b`: `\"foo\"`\n |\n = note: expected type `&str`\n found type `&'static [u8; 3]`\n\nIf you want more information on this error, try using \"rustc --explain E0308\"\n"
210210
}
211211
{
212212
"message": "aborting due to 3 previous errors",

0 commit comments

Comments
 (0)