@@ -82,6 +82,44 @@ fn simple_explicit_default_members() {
8282 assert ! ( !p. bin( "foo" ) . is_file( ) ) ;
8383}
8484
85+ #[ cargo_test]
86+ fn non_virtual_default_members_build_other_member ( ) {
87+ let p = project ( )
88+ . file (
89+ "Cargo.toml" ,
90+ r#"
91+ [project]
92+ name = "foo"
93+ version = "0.1.0"
94+ authors = []
95+
96+ [workspace]
97+ members = [".", "bar", "baz"]
98+ default-members = ["baz"]
99+ "# ,
100+ )
101+ . file ( "src/main.rs" , "fn main() {}" )
102+ . file ( "bar/Cargo.toml" , & basic_manifest ( "bar" , "0.1.0" ) )
103+ . file ( "bar/src/lib.rs" , "pub fn bar() {}" )
104+ . file ( "baz/Cargo.toml" , & basic_manifest ( "baz" , "0.1.0" ) )
105+ . file ( "baz/src/lib.rs" , "pub fn baz() {}" )
106+ . build ( ) ;
107+
108+ p. cargo ( "build" )
109+ . with_stderr (
110+ "[..] Compiling baz v0.1.0 ([..])\n \
111+ [..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n ",
112+ )
113+ . run ( ) ;
114+
115+ p. cargo ( "build --manifest-path bar/Cargo.toml" )
116+ . with_stderr (
117+ "[..] Compiling bar v0.1.0 ([..])\n \
118+ [..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n ",
119+ )
120+ . run ( ) ;
121+ }
122+
85123#[ cargo_test]
86124fn inferred_root ( ) {
87125 let p = project ( )
@@ -848,6 +886,31 @@ but is not a member.
848886 . run ( ) ;
849887}
850888
889+ #[ cargo_test]
890+ fn virtual_default_members_build_other_member ( ) {
891+ let p = project ( )
892+ . file (
893+ "Cargo.toml" ,
894+ r#"
895+ [workspace]
896+ members = ["bar", "baz"]
897+ default-members = ["baz"]
898+ "# ,
899+ )
900+ . file ( "bar/Cargo.toml" , & basic_manifest ( "bar" , "0.1.0" ) )
901+ . file ( "bar/src/lib.rs" , "pub fn bar() {}" )
902+ . file ( "baz/Cargo.toml" , & basic_manifest ( "baz" , "0.1.0" ) )
903+ . file ( "baz/src/lib.rs" , "pub fn baz() {}" )
904+ . build ( ) ;
905+
906+ p. cargo ( "build --manifest-path bar/Cargo.toml" )
907+ . with_stderr (
908+ "[..] Compiling bar v0.1.0 ([..])\n \
909+ [..] Finished dev [unoptimized + debuginfo] target(s) in [..]\n ",
910+ )
911+ . run ( ) ;
912+ }
913+
851914#[ cargo_test]
852915fn virtual_build_no_members ( ) {
853916 let p = project ( ) . file (
0 commit comments