Skip to content

Commit 6846f33

Browse files
committed
Adapt check-cfg tests to the new syntax
1 parent e512409 commit 6846f33

Some content is hidden

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

47 files changed

+588
-101
lines changed

tests/rustdoc-ui/check-cfg/check-cfg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// check-pass
2-
// compile-flags: --check-cfg=names() -Z unstable-options
2+
// compile-flags: --check-cfg=exhaustive(names) -Z unstable-options
33

44
/// uniz is nor a builtin nor pass as arguments so is unexpected
55
#[cfg(uniz)]

tests/rustdoc-ui/doctest/check-cfg-test.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// check-pass
2-
// compile-flags: --test --nocapture --check-cfg=values(feature,"test") -Z unstable-options
2+
// compile-flags: --test --nocapture --check-cfg=configure(feature,"test") -Z unstable-options
33
// normalize-stderr-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
44
// normalize-stdout-test: "tests/rustdoc-ui/doctest" -> "$$DIR"
55
// normalize-stdout-test "finished in \d+\.\d+s" -> "finished in $$TIME"

tests/ui/check-cfg/allow-at-crate-level.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test check that #![allow(unexpected_cfgs)] works with --cfg
22
//
33
// check-pass
4-
// compile-flags: --cfg=unexpected --check-cfg=names() -Z unstable-options
4+
// compile-flags: --cfg=unexpected --check-cfg=exhaustive(names) -Z unstable-options
55

66
#![allow(unexpected_cfgs)]
77

tests/ui/check-cfg/allow-macro-cfg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test check that local #[allow(unexpected_cfgs)] works
22
//
33
// check-pass
4-
// compile-flags:--check-cfg=names() -Z unstable-options
4+
// compile-flags: --check-cfg=exhaustive(names) -Z unstable-options
55

66
#[allow(unexpected_cfgs)]
77
fn foo() {

tests/ui/check-cfg/allow-same-level.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test check that #[allow(unexpected_cfgs)] doesn't work if put on the same level
22
//
33
// check-pass
4-
// compile-flags:--check-cfg=names() -Z unstable-options
4+
// compile-flags: --check-cfg=exhaustive(names) -Z unstable-options
55

66
#[allow(unexpected_cfgs)]
77
#[cfg(FALSE)]

tests/ui/check-cfg/allow-top-level.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test check that a top-level #![allow(unexpected_cfgs)] works
22
//
33
// check-pass
4-
// compile-flags:--check-cfg=names() -Z unstable-options
4+
// compile-flags: --check-cfg=exhaustive(names) -Z unstable-options
55

66
#![allow(unexpected_cfgs)]
77

tests/ui/check-cfg/allow-upper-level.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test check that #[allow(unexpected_cfgs)] work if put on an upper level
22
//
33
// check-pass
4-
// compile-flags:--check-cfg=names() -Z unstable-options
4+
// compile-flags: --check-cfg=exhaustive(names) -Z unstable-options
55

66
#[allow(unexpected_cfgs)]
77
mod aa {

tests/ui/check-cfg/compact-names.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test check that we correctly emit an warning for compact cfg
22
//
33
// check-pass
4-
// compile-flags:--check-cfg=names() -Z unstable-options
4+
// compile-flags: --check-cfg=exhaustive(names) -Z unstable-options
55

66
#![feature(cfg_target_compact)]
77

tests/ui/check-cfg/compact-values.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This test check that we correctly emit an warning for compact cfg
22
//
33
// check-pass
4-
// compile-flags:--check-cfg=values() -Z unstable-options
4+
// compile-flags: --check-cfg=exhaustive(values) -Z unstable-options
55

66
#![feature(cfg_target_compact)]
77

tests/ui/check-cfg/concat-values.rs

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// check-pass
2+
// compile-flags: -Z unstable-options
3+
// compile-flags: --check-cfg=configure(my_cfg,"foo") --check-cfg=configure(my_cfg,"bar")
4+
5+
#[cfg(my_cfg)]
6+
//~^ WARNING unexpected `cfg` condition value
7+
fn my_cfg() {}
8+
9+
#[cfg(my_cfg = "unk")]
10+
//~^ WARNING unexpected `cfg` condition value
11+
fn my_cfg() {}
12+
13+
fn main() {}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
warning: unexpected `cfg` condition value
2+
--> $DIR/concat-values.rs:5:7
3+
|
4+
LL | #[cfg(my_cfg)]
5+
| ^^^^^^
6+
|
7+
= note: expected values for `my_cfg` are: `bar`, `foo`
8+
= note: `#[warn(unexpected_cfgs)]` on by default
9+
10+
warning: unexpected `cfg` condition value
11+
--> $DIR/concat-values.rs:9:7
12+
|
13+
LL | #[cfg(my_cfg = "unk")]
14+
| ^^^^^^^^^^^^^^
15+
|
16+
= note: expected values for `my_cfg` are: `bar`, `foo`
17+
18+
warning: 2 warnings emitted
19+

tests/ui/check-cfg/diagnotics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// check-pass
2-
// compile-flags: --check-cfg=names() --check-cfg=values(feature,"foo") --check-cfg=values(no_values) -Z unstable-options
2+
// compile-flags: --check-cfg=exhaustive(names) --check-cfg=configure(feature,"foo") --check-cfg=configure(no_values) -Z unstable-options
33

44
#[cfg(featur)]
55
//~^ WARNING unexpected `cfg` condition name

tests/ui/check-cfg/empty-names.rs

-10
This file was deleted.

tests/ui/check-cfg/empty-names.stderr

-10
This file was deleted.

tests/ui/check-cfg/empty-values.rs

-10
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
warning: unexpected `cfg` condition name
2+
--> $DIR/exhaustive-names-values.rs:10:7
3+
|
4+
LL | #[cfg(unknown_key = "value")]
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(unexpected_cfgs)]` on by default
8+
9+
warning: unexpected `cfg` condition value
10+
--> $DIR/exhaustive-names-values.rs:14:7
11+
|
12+
LL | #[cfg(test = "value")]
13+
| ^^^^----------
14+
| |
15+
| help: remove the value
16+
|
17+
= note: no expected value for `test`
18+
19+
warning: unexpected `empty_names_values` as condition name
20+
|
21+
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names
22+
23+
warning: 3 warnings emitted
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
warning: unexpected `cfg` condition name
2+
--> $DIR/exhaustive-names-values.rs:10:7
3+
|
4+
LL | #[cfg(unknown_key = "value")]
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(unexpected_cfgs)]` on by default
8+
9+
warning: unexpected `cfg` condition value
10+
--> $DIR/exhaustive-names-values.rs:14:7
11+
|
12+
LL | #[cfg(test = "value")]
13+
| ^^^^----------
14+
| |
15+
| help: remove the value
16+
|
17+
= note: no expected value for `test`
18+
19+
warning: unexpected `exhaustive_names_values` as condition name
20+
|
21+
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names
22+
23+
warning: 3 warnings emitted
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
warning: unexpected `cfg` condition name
2+
--> $DIR/exhaustive-names-values.rs:10:7
3+
|
4+
LL | #[cfg(unknown_key = "value")]
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(unexpected_cfgs)]` on by default
8+
9+
warning: unexpected `cfg` condition value
10+
--> $DIR/exhaustive-names-values.rs:14:7
11+
|
12+
LL | #[cfg(test = "value")]
13+
| ^^^^----------
14+
| |
15+
| help: remove the value
16+
|
17+
= note: no expected value for `test`
18+
19+
warning: unexpected `cfg` condition value
20+
--> $DIR/exhaustive-names-values.rs:18:7
21+
|
22+
LL | #[cfg(feature = "unk")]
23+
| ^^^^^^^^^^^^^^^
24+
|
25+
= note: expected values for `feature` are: `std`
26+
27+
warning: unexpected `full` as condition name
28+
|
29+
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names
30+
31+
warning: 4 warnings emitted
32+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// Check warning for unexpected cfg
2+
//
3+
// check-pass
4+
// revisions: empty_names_values exhaustive_names_values full
5+
// compile-flags: -Z unstable-options
6+
// [empty_names_values]compile-flags: --check-cfg=names() --check-cfg=values()
7+
// [exhaustive_names_values]compile-flags: --check-cfg=exhaustive(names,values)
8+
// [full]compile-flags: --check-cfg=exhaustive(names,values) --check-cfg=configure(feature,"std")
9+
10+
#[cfg(unknown_key = "value")]
11+
//~^ WARNING unexpected `cfg` condition name
12+
pub fn f() {}
13+
14+
#[cfg(test = "value")]
15+
//~^ WARNING unexpected `cfg` condition value
16+
pub fn f() {}
17+
18+
#[cfg(feature = "unk")]
19+
//[full]~^ WARNING unexpected `cfg` condition value
20+
pub fn feat() {}
21+
22+
#[cfg(feature = "std")]
23+
pub fn feat() {}
24+
25+
#[cfg(windows)]
26+
pub fn win() {}
27+
28+
#[cfg(unix)]
29+
pub fn unix() {}
30+
31+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
warning: unexpected `cfg` condition name
2+
--> $DIR/exhaustive-names.rs:8:7
3+
|
4+
LL | #[cfg(unknown_key = "value")]
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(unexpected_cfgs)]` on by default
8+
9+
warning: unexpected `empty_names` as condition name
10+
|
11+
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names
12+
13+
warning: 2 warnings emitted
14+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
warning: unexpected `cfg` condition name
2+
--> $DIR/exhaustive-names.rs:8:7
3+
|
4+
LL | #[cfg(unknown_key = "value")]
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(unexpected_cfgs)]` on by default
8+
9+
warning: unexpected `exhaustive_names` as condition name
10+
|
11+
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names
12+
13+
warning: 2 warnings emitted
14+
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Check warning for unexpected cfg
2+
//
3+
// check-pass
4+
// revisions: empty_names exhaustive_names
5+
// [empty_names]compile-flags: --check-cfg=names() -Z unstable-options
6+
// [exhaustive_names]compile-flags: --check-cfg=exhaustive(names) -Z unstable-options
7+
8+
#[cfg(unknown_key = "value")]
9+
//~^ WARNING unexpected `cfg` condition name
10+
pub fn f() {}
11+
12+
fn main() {}

tests/ui/check-cfg/empty-values.stderr renamed to tests/ui/check-cfg/exhaustive-values.empty_values.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: unexpected `cfg` condition value
2-
--> $DIR/empty-values.rs:6:7
2+
--> $DIR/exhaustive-values.rs:8:7
33
|
44
LL | #[cfg(test = "value")]
55
| ^^^^----------
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
warning: unexpected `cfg` condition value
2+
--> $DIR/exhaustive-values.rs:8:7
3+
|
4+
LL | #[cfg(test = "value")]
5+
| ^^^^----------
6+
| |
7+
| help: remove the value
8+
|
9+
= note: no expected value for `test`
10+
= note: `#[warn(unexpected_cfgs)]` on by default
11+
12+
warning: 1 warning emitted
13+
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Check warning for unexpected cfg value
2+
//
3+
// check-pass
4+
// revisions: empty_values exhaustive_values
5+
// [empty_values]compile-flags: --check-cfg=values() -Z unstable-options
6+
// [exhaustive_values]compile-flags: --check-cfg=exhaustive(values) -Z unstable-options
7+
8+
#[cfg(test = "value")]
9+
//~^ WARNING unexpected `cfg` condition value
10+
pub fn f() {}
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
error: invalid `--check-cfg` argument: `anything_else(...)` (expected `names(name1, name2, ... nameN)` or `values(name, "value1", "value2", ... "valueN")`)
1+
error: invalid `--check-cfg` argument: `anything_else(...)` (expected `exhaustive(names, values)` or `configure(name, "value1", "value2", ... "valueN")`)
22

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
error: invalid `--check-cfg` argument: `configure(foo,"NOT_IDENT",bar)` (`configure()` names cannot be after values)
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
error: invalid `--check-cfg` argument: `configure("NOT_IDENT")` (`configure()` first arguments must be simple identifiers)
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
error: invalid `--check-cfg` argument: `exhaustive("NOT_IDENT")` (`exhaustive()` arguments must be simple identifiers)
2+

tests/ui/check-cfg/invalid-arguments.rs

+10-4
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22
//
33
// check-fail
44
// revisions: anything_else names_simple_ident values_simple_ident values_string_literals
5-
// [anything_else]compile-flags: -Z unstable-options --check-cfg=anything_else(...)
6-
// [names_simple_ident]compile-flags: -Z unstable-options --check-cfg=names("NOT_IDENT")
7-
// [values_simple_ident]compile-flags: -Z unstable-options --check-cfg=values("NOT_IDENT")
8-
// [values_string_literals]compile-flags: -Z unstable-options --check-cfg=values(test,12)
5+
// revisions: exhaustive_simple_ident configure_simple_ident configure_ident_after
6+
//
7+
// compile-flags: -Z unstable-options
8+
// [anything_else]compile-flags: --check-cfg=anything_else(...)
9+
// [names_simple_ident]compile-flags: --check-cfg=names("NOT_IDENT")
10+
// [values_simple_ident]compile-flags: --check-cfg=values("NOT_IDENT")
11+
// [values_string_literals]compile-flags: --check-cfg=values(test,12)
12+
// [exhaustive_simple_ident]compile-flags: --check-cfg=exhaustive("NOT_IDENT")
13+
// [configure_simple_ident]compile-flags: --check-cfg=configure("NOT_IDENT")
14+
// [configure_ident_after]compile-flags: --check-cfg=configure(foo,"NOT_IDENT",bar)
915

1016
fn main() {}

0 commit comments

Comments
 (0)