@@ -2618,6 +2618,70 @@ src/main.rs
26182618 p. cargo ( "package --allow-dirty" ) . run ( ) ;
26192619}
26202620
2621+ #[ cargo_test]
2622+ fn package_in_workspace_not_found ( ) {
2623+ let p = project ( )
2624+ . file (
2625+ "Cargo.toml" ,
2626+ r#"
2627+ [workspace]
2628+ members = ["bar", "baz"]
2629+ "# ,
2630+ )
2631+ . file ( "src/main.rs" , "fn main() {}" )
2632+ . file (
2633+ "bar/Cargo.toml" ,
2634+ r#"
2635+ [package]
2636+ name = "bar"
2637+ version = "0.0.1"
2638+ edition = "2015"
2639+ authors = []
2640+ license = "MIT"
2641+ description = "bar"
2642+ "# ,
2643+ )
2644+ . file ( "bar/src/main.rs" , "fn main() {}" )
2645+ . file (
2646+ "baz/Cargo.toml" ,
2647+ r#"
2648+ [package]
2649+ name = "baz"
2650+ version = "0.0.1"
2651+ edition = "2015"
2652+ authors = []
2653+ license = "MIT"
2654+ description = "baz"
2655+ "# ,
2656+ )
2657+ . file ( "baz/src/main.rs" , "fn main() {}" )
2658+ . build ( ) ;
2659+
2660+ p. cargo ( "package -p doesnt-exist" )
2661+ . with_stderr (
2662+ "\
2663+ [WARNING] manifest has no documentation, [..]
2664+ See [..]
2665+ [PACKAGING] bar v0.0.1 ([CWD]/bar)
2666+ [VERIFYING] bar v0.0.1 ([CWD]/bar)
2667+ [COMPILING] bar v0.0.1 ([CWD][..])
2668+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
2669+ [PACKAGED] [..] files, [..] ([..] compressed)
2670+ [WARNING] manifest has no documentation, [..]
2671+ See [..]
2672+ [PACKAGING] baz v0.0.1 ([CWD]/baz)
2673+ [VERIFYING] baz v0.0.1 ([CWD]/baz)
2674+ [COMPILING] baz v0.0.1 ([CWD][..])
2675+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
2676+ [PACKAGED] [..] files, [..] ([..] compressed)
2677+ " ,
2678+ )
2679+ . run ( ) ;
2680+
2681+ assert ! ( p. root( ) . join( "target/package/bar-0.0.1.crate" ) . is_file( ) ) ;
2682+ assert ! ( p. root( ) . join( "target/package/baz-0.0.1.crate" ) . is_file( ) ) ;
2683+ }
2684+
26212685#[ cargo_test]
26222686fn in_workspace ( ) {
26232687 let p = project ( )
0 commit comments