@@ -7739,3 +7739,131 @@ Caused by:
77397739"# ] ] )
77407740 . run ( ) ;
77417741}
7742+
7743+ #[ cargo_test]
7744+ fn metadata_check_runs_for_publish_false ( ) {
7745+ // Test that metadata check still runs when publish = false (empty array)
7746+ let p = project ( )
7747+ . file (
7748+ "Cargo.toml" ,
7749+ r#"
7750+ [package]
7751+ name = "foo"
7752+ version = "0.0.1"
7753+ edition = "2015"
7754+ authors = []
7755+ publish = false
7756+ "# ,
7757+ )
7758+ . file ( "src/main.rs" , "fn main() {}" )
7759+ . build ( ) ;
7760+
7761+ p. cargo ( "package" )
7762+ . with_stderr_data ( str![ [ r#"
7763+ [WARNING] manifest has no description, license, license-file, documentation, homepage or repository
7764+ |
7765+ = [NOTE] see https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info
7766+ [PACKAGING] foo v0.0.1 ([ROOT]/foo)
7767+ [PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
7768+ [VERIFYING] foo v0.0.1 ([ROOT]/foo)
7769+ [COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1)
7770+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
7771+
7772+ "# ] ] )
7773+ . run ( ) ;
7774+ }
7775+
7776+ #[ cargo_test]
7777+ fn metadata_check_skipped_for_non_crates_io_registry ( ) {
7778+ // Test that metadata warning is skipped when publish only includes non-crates.io registries
7779+ let p = project ( )
7780+ . file (
7781+ "Cargo.toml" ,
7782+ r#"
7783+ [package]
7784+ name = "foo"
7785+ version = "0.0.1"
7786+ edition = "2015"
7787+ authors = []
7788+ publish = ["my-registry"]
7789+ "# ,
7790+ )
7791+ . file ( "src/main.rs" , "fn main() {}" )
7792+ . build ( ) ;
7793+
7794+ p. cargo ( "package" )
7795+ . with_stderr_data ( str![ [ r#"
7796+ [PACKAGING] foo v0.0.1 ([ROOT]/foo)
7797+ [PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
7798+ [VERIFYING] foo v0.0.1 ([ROOT]/foo)
7799+ [COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1)
7800+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
7801+
7802+ "# ] ] )
7803+ . run ( ) ;
7804+ }
7805+
7806+ #[ cargo_test]
7807+ fn metadata_check_runs_for_crates_io_registry ( ) {
7808+ // Test that metadata check runs when publish includes "crates-io"
7809+ let p = project ( )
7810+ . file (
7811+ "Cargo.toml" ,
7812+ r#"
7813+ [package]
7814+ name = "foo"
7815+ version = "0.0.1"
7816+ edition = "2015"
7817+ authors = []
7818+ publish = ["crates-io", "my-registry"]
7819+ "# ,
7820+ )
7821+ . file ( "src/main.rs" , "fn main() {}" )
7822+ . build ( ) ;
7823+
7824+ p. cargo ( "package" )
7825+ . with_stderr_data ( str![ [ r#"
7826+ [WARNING] manifest has no description, license, license-file, documentation, homepage or repository
7827+ |
7828+ = [NOTE] see https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info
7829+ [PACKAGING] foo v0.0.1 ([ROOT]/foo)
7830+ [PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
7831+ [VERIFYING] foo v0.0.1 ([ROOT]/foo)
7832+ [COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1)
7833+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
7834+
7835+ "# ] ] )
7836+ . run ( ) ;
7837+ }
7838+
7839+ #[ cargo_test]
7840+ fn metadata_check_runs_when_publish_unspecified ( ) {
7841+ // Test that metadata check runs when publish is not specified (None case)
7842+ let p = project ( )
7843+ . file (
7844+ "Cargo.toml" ,
7845+ r#"
7846+ [package]
7847+ name = "foo"
7848+ version = "0.0.1"
7849+ edition = "2015"
7850+ authors = []
7851+ "# ,
7852+ )
7853+ . file ( "src/main.rs" , "fn main() {}" )
7854+ . build ( ) ;
7855+
7856+ p. cargo ( "package" )
7857+ . with_stderr_data ( str![ [ r#"
7858+ [WARNING] manifest has no description, license, license-file, documentation, homepage or repository
7859+ |
7860+ = [NOTE] see https://doc.rust-lang.org/cargo/reference/manifest.html#package-metadata for more info
7861+ [PACKAGING] foo v0.0.1 ([ROOT]/foo)
7862+ [PACKAGED] 4 files, [FILE_SIZE]B ([FILE_SIZE]B compressed)
7863+ [VERIFYING] foo v0.0.1 ([ROOT]/foo)
7864+ [COMPILING] foo v0.0.1 ([ROOT]/foo/target/package/foo-0.0.1)
7865+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
7866+
7867+ "# ] ] )
7868+ . run ( ) ;
7869+ }
0 commit comments