Skip to content

Commit 2d0ca84

Browse files
committed
Move check cfg tests to their own module
1 parent 6a9f094 commit 2d0ca84

File tree

6 files changed

+552
-556
lines changed

6 files changed

+552
-556
lines changed

tests/testsuite/build.rs

Lines changed: 0 additions & 250 deletions
Original file line numberDiff line numberDiff line change
@@ -6224,253 +6224,3 @@ fn primary_package_env_var() {
62246224

62256225
foo.cargo("test").run();
62266226
}
6227-
6228-
#[cfg_attr(windows, ignore)] // weird normalization issue with windows and cargo-test-support
6229-
#[cargo_test]
6230-
fn check_cfg_features() {
6231-
if !is_nightly() {
6232-
// --check-cfg is a nightly only rustc command line
6233-
return;
6234-
}
6235-
6236-
let p = project()
6237-
.file(
6238-
"Cargo.toml",
6239-
r#"
6240-
[project]
6241-
name = "foo"
6242-
version = "0.1.0"
6243-
6244-
[features]
6245-
f_a = []
6246-
f_b = []
6247-
"#,
6248-
)
6249-
.file("src/main.rs", "fn main() {}")
6250-
.build();
6251-
6252-
p.cargo("build -v -Zcheck-cfg=features")
6253-
.masquerade_as_nightly_cargo()
6254-
.with_stderr(
6255-
"\
6256-
[COMPILING] foo v0.1.0 [..]
6257-
[RUNNING] `rustc [..] --check-cfg 'values(feature, \"f_a\", \"f_b\")' [..]
6258-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
6259-
",
6260-
)
6261-
.run();
6262-
}
6263-
6264-
#[cfg_attr(windows, ignore)] // weird normalization issue with windows and cargo-test-support
6265-
#[cargo_test]
6266-
fn check_cfg_features_with_deps() {
6267-
if !is_nightly() {
6268-
// --check-cfg is a nightly only rustc command line
6269-
return;
6270-
}
6271-
6272-
let p = project()
6273-
.file(
6274-
"Cargo.toml",
6275-
r#"
6276-
[project]
6277-
name = "foo"
6278-
version = "0.1.0"
6279-
6280-
[dependencies]
6281-
bar = { path = "bar/" }
6282-
6283-
[features]
6284-
f_a = []
6285-
f_b = []
6286-
"#,
6287-
)
6288-
.file("src/main.rs", "fn main() {}")
6289-
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
6290-
.file("bar/src/lib.rs", "#[allow(dead_code)] fn bar() {}")
6291-
.build();
6292-
6293-
p.cargo("build -v -Zcheck-cfg=features")
6294-
.masquerade_as_nightly_cargo()
6295-
.with_stderr(
6296-
"\
6297-
[COMPILING] bar v0.1.0 [..]
6298-
[RUNNING] `rustc [..] --check-cfg 'values(feature)' [..]
6299-
[COMPILING] foo v0.1.0 [..]
6300-
[RUNNING] `rustc --crate-name foo [..] --check-cfg 'values(feature, \"f_a\", \"f_b\")' [..]
6301-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
6302-
",
6303-
)
6304-
.run();
6305-
}
6306-
6307-
#[cfg_attr(windows, ignore)] // weird normalization issue with windows and cargo-test-support
6308-
#[cargo_test]
6309-
fn check_cfg_features_with_opt_deps() {
6310-
if !is_nightly() {
6311-
// --check-cfg is a nightly only rustc command line
6312-
return;
6313-
}
6314-
6315-
let p = project()
6316-
.file(
6317-
"Cargo.toml",
6318-
r#"
6319-
[project]
6320-
name = "foo"
6321-
version = "0.1.0"
6322-
6323-
[dependencies]
6324-
bar = { path = "bar/", optional = true }
6325-
6326-
[features]
6327-
default = ["bar"]
6328-
f_a = []
6329-
f_b = []
6330-
"#,
6331-
)
6332-
.file("src/main.rs", "fn main() {}")
6333-
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
6334-
.file("bar/src/lib.rs", "#[allow(dead_code)] fn bar() {}")
6335-
.build();
6336-
6337-
p.cargo("build -v -Zcheck-cfg=features")
6338-
.masquerade_as_nightly_cargo()
6339-
.with_stderr(
6340-
"\
6341-
[COMPILING] bar v0.1.0 [..]
6342-
[RUNNING] `rustc [..] --check-cfg 'values(feature)' [..]
6343-
[COMPILING] foo v0.1.0 [..]
6344-
[RUNNING] `rustc --crate-name foo [..] --check-cfg 'values(feature, \"bar\", \"default\", \"f_a\", \"f_b\")' [..]
6345-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
6346-
",
6347-
)
6348-
.run();
6349-
}
6350-
6351-
#[cfg_attr(windows, ignore)] // weird normalization issue with windows and cargo-test-support
6352-
#[cargo_test]
6353-
fn check_cfg_features_with_namespaced_features() {
6354-
if !is_nightly() {
6355-
// --check-cfg is a nightly only rustc command line
6356-
return;
6357-
}
6358-
6359-
let p = project()
6360-
.file(
6361-
"Cargo.toml",
6362-
r#"
6363-
[project]
6364-
name = "foo"
6365-
version = "0.1.0"
6366-
6367-
[dependencies]
6368-
bar = { path = "bar/", optional = true }
6369-
6370-
[features]
6371-
f_a = ["dep:bar"]
6372-
f_b = []
6373-
"#,
6374-
)
6375-
.file("src/main.rs", "fn main() {}")
6376-
.file("bar/Cargo.toml", &basic_manifest("bar", "0.1.0"))
6377-
.file("bar/src/lib.rs", "#[allow(dead_code)] fn bar() {}")
6378-
.build();
6379-
6380-
p.cargo("build -v -Zcheck-cfg=features")
6381-
.masquerade_as_nightly_cargo()
6382-
.with_stderr(
6383-
"\
6384-
[COMPILING] foo v0.1.0 [..]
6385-
[RUNNING] `rustc --crate-name foo [..] --check-cfg 'values(feature, \"f_a\", \"f_b\")' [..]
6386-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
6387-
",
6388-
)
6389-
.run();
6390-
}
6391-
6392-
#[cfg_attr(windows, ignore)] // weird normalization issue with windows and cargo-test-support
6393-
#[cargo_test]
6394-
fn check_cfg_well_known_names() {
6395-
if !is_nightly() {
6396-
// --check-cfg is a nightly only rustc command line
6397-
return;
6398-
}
6399-
6400-
let p = project()
6401-
.file("Cargo.toml", &basic_manifest("foo", "0.1.0"))
6402-
.file("src/main.rs", "fn main() {}")
6403-
.build();
6404-
6405-
p.cargo("build -v -Zcheck-cfg=names")
6406-
.masquerade_as_nightly_cargo()
6407-
.with_stderr(
6408-
"\
6409-
[COMPILING] foo v0.1.0 [..]
6410-
[RUNNING] `rustc [..] --check-cfg 'names()' [..]
6411-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
6412-
",
6413-
)
6414-
.run();
6415-
}
6416-
6417-
#[cfg_attr(windows, ignore)] // weird normalization issue with windows and cargo-test-support
6418-
#[cargo_test]
6419-
fn check_cfg_well_known_values() {
6420-
if !is_nightly() {
6421-
// --check-cfg is a nightly only rustc command line
6422-
return;
6423-
}
6424-
6425-
let p = project()
6426-
.file("Cargo.toml", &basic_manifest("foo", "0.1.0"))
6427-
.file("src/main.rs", "fn main() {}")
6428-
.build();
6429-
6430-
p.cargo("build -v -Zcheck-cfg=values")
6431-
.masquerade_as_nightly_cargo()
6432-
.with_stderr(
6433-
"\
6434-
[COMPILING] foo v0.1.0 [..]
6435-
[RUNNING] `rustc [..] --check-cfg 'values()' [..]
6436-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
6437-
",
6438-
)
6439-
.run();
6440-
}
6441-
6442-
#[cfg_attr(windows, ignore)] // weird normalization issue with windows and cargo-test-support
6443-
#[cargo_test]
6444-
fn check_cfg_all() {
6445-
if !is_nightly() {
6446-
// --check-cfg is a nightly only rustc command line
6447-
return;
6448-
}
6449-
6450-
let p = project()
6451-
.file(
6452-
"Cargo.toml",
6453-
r#"
6454-
[project]
6455-
name = "foo"
6456-
version = "0.1.0"
6457-
6458-
[features]
6459-
f_a = []
6460-
f_b = []
6461-
"#,
6462-
)
6463-
.file("src/main.rs", "fn main() {}")
6464-
.build();
6465-
6466-
p.cargo("build -v -Zcheck-cfg=features,names,values")
6467-
.masquerade_as_nightly_cargo()
6468-
.with_stderr(
6469-
"\
6470-
[COMPILING] foo v0.1.0 [..]
6471-
[RUNNING] `rustc [..] --check-cfg 'values(feature, \"f_a\", \"f_b\")' --check-cfg 'names()' --check-cfg 'values()' [..]
6472-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
6473-
",
6474-
)
6475-
.run();
6476-
}

tests/testsuite/check.rs

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
use std::fmt::{self, Write};
44

55
use cargo_test_support::install::exe;
6-
use cargo_test_support::is_nightly;
76
use cargo_test_support::paths::CargoPathExt;
87
use cargo_test_support::registry::Package;
98
use cargo_test_support::tools;
@@ -1014,89 +1013,3 @@ fn rustc_workspace_wrapper_excludes_published_deps() {
10141013
.with_stdout_does_not_contain("WRAPPER CALLED: rustc --crate-name baz [..]")
10151014
.run();
10161015
}
1017-
1018-
#[cfg_attr(windows, ignore)] // weird normalization issue with windows and cargo-test-support
1019-
#[cargo_test]
1020-
fn check_cfg_features() {
1021-
if !is_nightly() {
1022-
// --check-cfg is a nightly only rustc command line
1023-
return;
1024-
}
1025-
1026-
let p = project()
1027-
.file(
1028-
"Cargo.toml",
1029-
r#"
1030-
[project]
1031-
name = "foo"
1032-
version = "0.1.0"
1033-
1034-
[features]
1035-
f_a = []
1036-
f_b = []
1037-
"#,
1038-
)
1039-
.file("src/main.rs", "fn main() {}")
1040-
.build();
1041-
1042-
p.cargo("check -v -Zcheck-cfg=features")
1043-
.masquerade_as_nightly_cargo()
1044-
.with_stderr(
1045-
"\
1046-
[CHECKING] foo v0.1.0 [..]
1047-
[RUNNING] `rustc [..] --check-cfg 'values(feature, \"f_a\", \"f_b\")' [..]
1048-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
1049-
",
1050-
)
1051-
.run();
1052-
}
1053-
1054-
#[cfg_attr(windows, ignore)] // weird normalization issue with windows and cargo-test-support
1055-
#[cargo_test]
1056-
fn check_cfg_well_known_names() {
1057-
if !is_nightly() {
1058-
// --check-cfg is a nightly only rustc command line
1059-
return;
1060-
}
1061-
1062-
let p = project()
1063-
.file("Cargo.toml", &basic_manifest("foo", "0.1.0"))
1064-
.file("src/main.rs", "fn main() {}")
1065-
.build();
1066-
1067-
p.cargo("check -v -Zcheck-cfg=names")
1068-
.masquerade_as_nightly_cargo()
1069-
.with_stderr(
1070-
"\
1071-
[CHECKING] foo v0.1.0 [..]
1072-
[RUNNING] `rustc [..] --check-cfg 'names()' [..]
1073-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
1074-
",
1075-
)
1076-
.run();
1077-
}
1078-
1079-
#[cfg_attr(windows, ignore)] // weird normalization issue with windows and cargo-test-support
1080-
#[cargo_test]
1081-
fn check_cfg_well_known_values() {
1082-
if !is_nightly() {
1083-
// --check-cfg is a nightly only rustc command line
1084-
return;
1085-
}
1086-
1087-
let p = project()
1088-
.file("Cargo.toml", &basic_manifest("foo", "0.1.0"))
1089-
.file("src/main.rs", "fn main() {}")
1090-
.build();
1091-
1092-
p.cargo("check -v -Zcheck-cfg=values")
1093-
.masquerade_as_nightly_cargo()
1094-
.with_stderr(
1095-
"\
1096-
[CHECKING] foo v0.1.0 [..]
1097-
[RUNNING] `rustc [..] --check-cfg 'values()' [..]
1098-
[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
1099-
",
1100-
)
1101-
.run();
1102-
}

0 commit comments

Comments
 (0)