diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-11-16 11:32:26 +0100 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2023-11-16 18:07:26 +0100 |
| commit | a621d71b4e06742763b14d7d83fb8c130804fb4a (patch) | |
| tree | 8ef42ecc2f56b72de1ef2fb859edaa0430f83e1c | |
| parent | 74451cd060c72b1bf31e1d8da6a3ecf32a76c7fd (diff) | |
| download | rust-a621d71b4e06742763b14d7d83fb8c130804fb4a.tar.gz rust-a621d71b4e06742763b14d7d83fb8c130804fb4a.zip | |
Add UI test for mispelled `test`
| -rw-r--r-- | tests/ui/cfg_features.fixed | 12 | ||||
| -rw-r--r-- | tests/ui/cfg_features.rs | 12 | ||||
| -rw-r--r-- | tests/ui/cfg_features.stderr | 26 |
3 files changed, 49 insertions, 1 deletions
diff --git a/tests/ui/cfg_features.fixed b/tests/ui/cfg_features.fixed index 3d52f2382ea..2a02132a740 100644 --- a/tests/ui/cfg_features.fixed +++ b/tests/ui/cfg_features.fixed @@ -14,4 +14,16 @@ fn main() { //~^ ERROR: feature may misspelled as features //~| ERROR: feature may misspelled as features let _ = 1 + 2; + + #[cfg(test)] + //~^ ERROR: 'test' may be misspelled as 'tests' + let _ = 2; + #[cfg(test)] + //~^ ERROR: 'test' may be misspelled as 'Test' + let _ = 2; + + #[cfg(all(test, test))] + //~^ ERROR: 'test' may be misspelled as 'tests' + //~| ERROR: 'test' may be misspelled as 'Test' + let _ = 2; } diff --git a/tests/ui/cfg_features.rs b/tests/ui/cfg_features.rs index a0344a00447..efe2fb04922 100644 --- a/tests/ui/cfg_features.rs +++ b/tests/ui/cfg_features.rs @@ -14,4 +14,16 @@ fn main() { //~^ ERROR: feature may misspelled as features //~| ERROR: feature may misspelled as features let _ = 1 + 2; + + #[cfg(tests)] + //~^ ERROR: 'test' may be misspelled as 'tests' + let _ = 2; + #[cfg(Test)] + //~^ ERROR: 'test' may be misspelled as 'Test' + let _ = 2; + + #[cfg(all(tests, Test))] + //~^ ERROR: 'test' may be misspelled as 'tests' + //~| ERROR: 'test' may be misspelled as 'Test' + let _ = 2; } diff --git a/tests/ui/cfg_features.stderr b/tests/ui/cfg_features.stderr index 401c3e92ed9..441de5b41f4 100644 --- a/tests/ui/cfg_features.stderr +++ b/tests/ui/cfg_features.stderr @@ -25,5 +25,29 @@ error: feature may misspelled as features LL | #[cfg(all(features = "wrong1", any(feature = "right", features = "wrong2", feature, features)))] | ^^^^^^^^^^^^^^^^^^^ help: use: `feature = "wrong2"` -error: aborting due to 4 previous errors +error: 'test' may be misspelled as 'tests' + --> $DIR/cfg_features.rs:18:11 + | +LL | #[cfg(tests)] + | ^^^^^ help: do you mean: `test` + +error: 'test' may be misspelled as 'Test' + --> $DIR/cfg_features.rs:21:11 + | +LL | #[cfg(Test)] + | ^^^^ help: do you mean: `test` + +error: 'test' may be misspelled as 'tests' + --> $DIR/cfg_features.rs:25:15 + | +LL | #[cfg(all(tests, Test))] + | ^^^^^ help: do you mean: `test` + +error: 'test' may be misspelled as 'Test' + --> $DIR/cfg_features.rs:25:22 + | +LL | #[cfg(all(tests, Test))] + | ^^^^ help: do you mean: `test` + +error: aborting due to 8 previous errors |
