@@ -2618,6 +2618,71 @@ src/main.rs
2618
2618
p. cargo ( "package --allow-dirty" ) . run ( ) ;
2619
2619
}
2620
2620
2621
+ #[ cargo_test]
2622
+ fn package_in_workspace_no_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
+ . env ( "CARGO_LOG" , "cargo::ops::cargo_compile=trace" )
2662
+ . with_stderr (
2663
+ "\
2664
+ [WARNING] manifest has no documentation, [..]
2665
+ See [..]
2666
+ [PACKAGING] bar v0.0.1 ([CWD]/bar)
2667
+ [VERIFYING] bar v0.0.1 ([CWD]/bar)
2668
+ [COMPILING] bar v0.0.1 ([CWD][..])
2669
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
2670
+ [PACKAGED] [..] files, [..] ([..] compressed)
2671
+ [WARNING] manifest has no documentation, [..]
2672
+ See [..]
2673
+ [PACKAGING] baz v0.0.1 ([CWD]/baz)
2674
+ [VERIFYING] baz v0.0.1 ([CWD]/baz)
2675
+ [COMPILING] baz v0.0.1 ([CWD][..])
2676
+ [FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [..]
2677
+ [PACKAGED] [..] files, [..] ([..] compressed)
2678
+ " ,
2679
+ )
2680
+ . run ( ) ;
2681
+
2682
+ assert ! ( p. root( ) . join( "target/package/bar-0.0.1.crate" ) . is_file( ) ) ;
2683
+ assert ! ( p. root( ) . join( "target/package/baz-0.0.1.crate" ) . is_file( ) ) ;
2684
+ }
2685
+
2621
2686
#[ cargo_test]
2622
2687
fn in_workspace ( ) {
2623
2688
let p = project ( )
0 commit comments