@@ -34,7 +34,7 @@ path = "src/main.rs"
3434 . unwrap ( ) ;
3535
3636 // Act
37- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
37+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
3838 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
3939 skeleton
4040 . build_minimum_project ( cook_directory. path ( ) , false )
@@ -53,7 +53,7 @@ path = "src/main.rs"
5353 . assert ( predicate:: path:: exists ( ) ) ;
5454
5555 // Act (no_std)
56- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
56+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
5757 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
5858 skeleton
5959 . build_minimum_project ( cook_directory. path ( ) , true )
@@ -140,7 +140,7 @@ uuid = { version = "=0.8.0", features = ["v4"] }
140140 project_b. child ( "src" ) . child ( "lib.rs" ) . touch ( ) . unwrap ( ) ;
141141
142142 // Act
143- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
143+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
144144 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
145145 skeleton
146146 . build_minimum_project ( cook_directory. path ( ) , false )
@@ -162,7 +162,7 @@ uuid = { version = "=0.8.0", features = ["v4"] }
162162 . assert ( "" ) ;
163163
164164 // Act (no_std)
165- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
165+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
166166 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
167167 skeleton
168168 . build_minimum_project ( cook_directory. path ( ) , true )
@@ -229,7 +229,7 @@ harness = false
229229 . unwrap ( ) ;
230230
231231 // Act
232- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
232+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
233233 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
234234 skeleton
235235 . build_minimum_project ( cook_directory. path ( ) , false )
@@ -277,7 +277,7 @@ name = "foo"
277277 . unwrap ( ) ;
278278
279279 // Act
280- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
280+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
281281 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
282282 skeleton
283283 . build_minimum_project ( cook_directory. path ( ) , false )
@@ -290,7 +290,7 @@ name = "foo"
290290 cook_directory. child ( "tests" ) . child ( "foo.rs" ) . assert ( "" ) ;
291291
292292 // Act (no_std)
293- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
293+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
294294 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
295295 skeleton
296296 . build_minimum_project ( cook_directory. path ( ) , true )
@@ -349,7 +349,7 @@ name = "foo"
349349 . unwrap ( ) ;
350350
351351 // Act
352- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
352+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
353353 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
354354 skeleton
355355 . build_minimum_project ( cook_directory. path ( ) , false )
@@ -365,7 +365,7 @@ name = "foo"
365365 . assert ( "fn main() {}" ) ;
366366
367367 // Act (no_std)
368- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
368+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
369369 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
370370 skeleton
371371 . build_minimum_project ( cook_directory. path ( ) , true )
@@ -409,14 +409,14 @@ edition = "2018"
409409 bin_dir. child ( "f.rs" ) . touch ( ) . unwrap ( ) ;
410410
411411 // Act
412- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
412+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
413413
414414 // What we're testing is that auto-directories come back in the same order.
415415 // Since it's possible that the directories just happen to come back in the
416416 // same order randomly, we'll run this a few times to increase the
417417 // likelihood of triggering the problem if it exists.
418418 for _ in 0 ..5 {
419- let skeleton2 = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
419+ let skeleton2 = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
420420 assert_eq ! (
421421 skeleton, skeleton2,
422422 "Skeletons of equal directories are not equal. Check [[bin]] ordering in manifest?"
@@ -453,7 +453,7 @@ pub fn config_toml() {
453453 . unwrap ( ) ;
454454
455455 // Act
456- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
456+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
457457 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
458458 skeleton
459459 . build_minimum_project ( cook_directory. path ( ) , false )
@@ -502,7 +502,7 @@ pub fn version() {
502502 . unwrap ( ) ;
503503
504504 // Act
505- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
505+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
506506 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
507507 skeleton
508508 . build_minimum_project ( cook_directory. path ( ) , false )
@@ -555,7 +555,7 @@ version = "1.2.3"
555555 . unwrap ( ) ;
556556
557557 // Act
558- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
558+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
559559 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
560560 skeleton
561561 . build_minimum_project ( cook_directory. path ( ) , false )
@@ -671,7 +671,7 @@ checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7"
671671 project_b. child ( "src" ) . child ( "lib.rs" ) . touch ( ) . unwrap ( ) ;
672672
673673 // Act
674- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
674+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
675675 let cook_directory = TempDir :: new ( ) . unwrap ( ) ;
676676 skeleton
677677 . build_minimum_project ( cook_directory. path ( ) , false )
@@ -886,12 +886,70 @@ description = "sample package representing all of rocket's dependencies""#;
886886 . unwrap ( ) ;
887887
888888 // Act
889- let skeleton = Skeleton :: derive ( recipe_directory. path ( ) ) . unwrap ( ) ;
889+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , None ) . unwrap ( ) ;
890890
891891 // Assert
892892 assert_eq ! ( 1 , skeleton. manifests. len( ) ) ;
893893}
894894
895+ #[ test]
896+ pub fn specify_member_in_workspace ( ) {
897+ // Arrange
898+ let workspace_content = r#"
899+ [workspace]
900+
901+ members = [
902+ "backend",
903+ "ci",
904+ ]
905+ "# ;
906+
907+ let first_content = r#"
908+ [package]
909+ name = "backend"
910+ version = "0.1.0"
911+ edition = "2018"
912+ "# ;
913+
914+ let recipe_directory = TempDir :: new ( ) . unwrap ( ) ;
915+ let manifest = recipe_directory. child ( "Cargo.toml" ) ;
916+ manifest. write_str ( workspace_content) . unwrap ( ) ;
917+ let backend = recipe_directory. child ( "backend" ) ;
918+ backend. create_dir_all ( ) . unwrap ( ) ;
919+
920+ backend
921+ . child ( "Cargo.toml" )
922+ . write_str ( first_content)
923+ . unwrap ( ) ;
924+ backend. child ( "src" ) . create_dir_all ( ) . unwrap ( ) ;
925+ backend. child ( "src" ) . child ( "main.rs" ) . touch ( ) . unwrap ( ) ;
926+
927+ // Act
928+ let skeleton = Skeleton :: derive ( recipe_directory. path ( ) , "backend" . to_string ( ) . into ( ) ) . unwrap ( ) ;
929+
930+ let gold = r#"[workspace]
931+ members = ["backend"]
932+ "# ;
933+
934+ // Assert:
935+ // - that "ci" is not in `skeleton`'s manifests
936+ assert ! ( skeleton
937+ . manifests
938+ . iter( )
939+ . all( |manifest| !manifest. contents. contains( "ci" ) ) ) ;
940+
941+ // - that the root manifest matches the file contents
942+ assert ! (
943+ skeleton
944+ . manifests
945+ . iter( )
946+ . find( |manifest| manifest. relative_path == std:: path:: PathBuf :: from( "Cargo.toml" ) )
947+ . unwrap( )
948+ . contents
949+ == gold
950+ ) ;
951+ }
952+
895953fn check ( actual : & str , expect : Expect ) {
896954 let actual = actual. to_string ( ) ;
897955 expect. assert_eq ( & actual) ;
0 commit comments