@@ -4575,3 +4575,109 @@ fn check_cfg_features_doc() {
45754575 )
45764576 . run ( ) ;
45774577}
4578+
4579+ #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
4580+ #[ cargo_test]
4581+ fn check_cfg_well_known_names ( ) {
4582+ if !is_nightly ( ) {
4583+ // --check-cfg is a nightly only rustc command line
4584+ return ;
4585+ }
4586+
4587+ let p = project ( )
4588+ . file ( "Cargo.toml" , & basic_manifest ( "foo" , "0.1.0" ) )
4589+ . file ( "src/main.rs" , "fn main() {}" )
4590+ . build ( ) ;
4591+
4592+ p. cargo ( "test -v -Z check-cfg-well-known-names" )
4593+ . masquerade_as_nightly_cargo ( )
4594+ . with_stderr (
4595+ "\
4596+ [COMPILING] foo v0.1.0 [..]
4597+ [RUNNING] `rustc [..] --check-cfg 'names()' [..]
4598+ [FINISHED] test [unoptimized + debuginfo] target(s) in [..]
4599+ [RUNNING] [..]
4600+ " ,
4601+ )
4602+ . run ( ) ;
4603+ }
4604+
4605+ #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
4606+ #[ cargo_test]
4607+ fn check_cfg_well_known_values ( ) {
4608+ if !is_nightly ( ) {
4609+ // --check-cfg is a nightly only rustc command line
4610+ return ;
4611+ }
4612+
4613+ let p = project ( )
4614+ . file ( "Cargo.toml" , & basic_manifest ( "foo" , "0.1.0" ) )
4615+ . file ( "src/main.rs" , "fn main() {}" )
4616+ . build ( ) ;
4617+
4618+ p. cargo ( "test -v -Z check-cfg-well-known-values" )
4619+ . masquerade_as_nightly_cargo ( )
4620+ . with_stderr (
4621+ "\
4622+ [COMPILING] foo v0.1.0 [..]
4623+ [RUNNING] `rustc [..] --check-cfg 'values()' [..]
4624+ [FINISHED] test [unoptimized + debuginfo] target(s) in [..]
4625+ [RUNNING] [..]
4626+ " ,
4627+ )
4628+ . run ( ) ;
4629+ }
4630+
4631+ #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
4632+ #[ cargo_test]
4633+ fn check_cfg_well_known_names_doc ( ) {
4634+ if !is_nightly ( ) {
4635+ // --check-cfg is a nightly only rustc command line
4636+ return ;
4637+ }
4638+
4639+ let p = project ( )
4640+ . file ( "Cargo.toml" , & basic_manifest ( "foo" , "0.1.0" ) )
4641+ . file ( "src/lib.rs" , "#[allow(dead_code)] fn foo() {}" )
4642+ . build ( ) ;
4643+
4644+ p. cargo ( "test -v --doc -Z check-cfg-well-known-names" )
4645+ . masquerade_as_nightly_cargo ( )
4646+ . with_stderr (
4647+ "\
4648+ [COMPILING] foo v0.1.0 [..]
4649+ [RUNNING] `rustc [..] --check-cfg 'names()' [..]
4650+ [FINISHED] test [unoptimized + debuginfo] target(s) in [..]
4651+ [DOCTEST] foo
4652+ [RUNNING] `rustdoc [..] --check-cfg 'names()' [..]
4653+ " ,
4654+ )
4655+ . run ( ) ;
4656+ }
4657+
4658+ #[ cfg_attr( windows, ignore) ] // weird normalization issue with windows and cargo-test-support
4659+ #[ cargo_test]
4660+ fn check_cfg_well_known_values_doc ( ) {
4661+ if !is_nightly ( ) {
4662+ // --check-cfg is a nightly only rustc command line
4663+ return ;
4664+ }
4665+
4666+ let p = project ( )
4667+ . file ( "Cargo.toml" , & basic_manifest ( "foo" , "0.1.0" ) )
4668+ . file ( "src/lib.rs" , "#[allow(dead_code)] fn foo() {}" )
4669+ . build ( ) ;
4670+
4671+ p. cargo ( "test -v --doc -Z check-cfg-well-known-values" )
4672+ . masquerade_as_nightly_cargo ( )
4673+ . with_stderr (
4674+ "\
4675+ [COMPILING] foo v0.1.0 [..]
4676+ [RUNNING] `rustc [..] --check-cfg 'values()' [..]
4677+ [FINISHED] test [unoptimized + debuginfo] target(s) in [..]
4678+ [DOCTEST] foo
4679+ [RUNNING] `rustdoc [..] --check-cfg 'values()' [..]
4680+ " ,
4681+ )
4682+ . run ( ) ;
4683+ }
0 commit comments