Skip to content

Commit a621d71

Browse files
Add UI test for mispelled test
1 parent 74451cd commit a621d71

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

tests/ui/cfg_features.fixed

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,16 @@ fn main() {
1414
//~^ ERROR: feature may misspelled as features
1515
//~| ERROR: feature may misspelled as features
1616
let _ = 1 + 2;
17+
18+
#[cfg(test)]
19+
//~^ ERROR: 'test' may be misspelled as 'tests'
20+
let _ = 2;
21+
#[cfg(test)]
22+
//~^ ERROR: 'test' may be misspelled as 'Test'
23+
let _ = 2;
24+
25+
#[cfg(all(test, test))]
26+
//~^ ERROR: 'test' may be misspelled as 'tests'
27+
//~| ERROR: 'test' may be misspelled as 'Test'
28+
let _ = 2;
1729
}

tests/ui/cfg_features.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,16 @@ fn main() {
1414
//~^ ERROR: feature may misspelled as features
1515
//~| ERROR: feature may misspelled as features
1616
let _ = 1 + 2;
17+
18+
#[cfg(tests)]
19+
//~^ ERROR: 'test' may be misspelled as 'tests'
20+
let _ = 2;
21+
#[cfg(Test)]
22+
//~^ ERROR: 'test' may be misspelled as 'Test'
23+
let _ = 2;
24+
25+
#[cfg(all(tests, Test))]
26+
//~^ ERROR: 'test' may be misspelled as 'tests'
27+
//~| ERROR: 'test' may be misspelled as 'Test'
28+
let _ = 2;
1729
}

tests/ui/cfg_features.stderr

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,29 @@ error: feature may misspelled as features
2525
LL | #[cfg(all(features = "wrong1", any(feature = "right", features = "wrong2", feature, features)))]
2626
| ^^^^^^^^^^^^^^^^^^^ help: use: `feature = "wrong2"`
2727

28-
error: aborting due to 4 previous errors
28+
error: 'test' may be misspelled as 'tests'
29+
--> $DIR/cfg_features.rs:18:11
30+
|
31+
LL | #[cfg(tests)]
32+
| ^^^^^ help: do you mean: `test`
33+
34+
error: 'test' may be misspelled as 'Test'
35+
--> $DIR/cfg_features.rs:21:11
36+
|
37+
LL | #[cfg(Test)]
38+
| ^^^^ help: do you mean: `test`
39+
40+
error: 'test' may be misspelled as 'tests'
41+
--> $DIR/cfg_features.rs:25:15
42+
|
43+
LL | #[cfg(all(tests, Test))]
44+
| ^^^^^ help: do you mean: `test`
45+
46+
error: 'test' may be misspelled as 'Test'
47+
--> $DIR/cfg_features.rs:25:22
48+
|
49+
LL | #[cfg(all(tests, Test))]
50+
| ^^^^ help: do you mean: `test`
51+
52+
error: aborting due to 8 previous errors
2953

0 commit comments

Comments
 (0)