File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,4 +95,44 @@ mod tests {
9595
9696 temp. close ( ) . unwrap ( ) ;
9797 }
98+
99+ #[ test]
100+ fn test_where_scanned_folder_has_three_rust_projects ( ) {
101+ // given
102+ let temp = TempDir :: new ( ) . unwrap ( ) ;
103+ let project1 = mk_subpath ( & temp, "project1" ) ;
104+ mk_rust_project ( & project1) ;
105+ let project2 = mk_subpath ( & temp, "project2" ) ;
106+ mk_rust_project ( & project2) ;
107+ let project3 = mk_subpath ( & temp, "work/project3" ) ;
108+ mk_rust_project ( & project3) ;
109+
110+ // when
111+ let mut results = fetch_artifacts ( & temp. to_path_buf ( ) ) ;
112+
113+ // then
114+ assert_eq ! ( results. len( ) , 3 , "Expected exactly three artifacts" ) ;
115+ results. sort ( ) ;
116+
117+ let expected_path_1 =
118+ temp. child ( "project1" ) . child ( "target" ) . path ( ) . to_path_buf ( ) ;
119+ let expected_1 = ArtifactCandidate :: new ( expected_path_1) ;
120+ assert_eq ! ( & results[ 0 ] , & expected_1) ;
121+
122+ let expected_path_2 =
123+ temp. child ( "project2" ) . child ( "target" ) . path ( ) . to_path_buf ( ) ;
124+ let expected_2 = ArtifactCandidate :: new ( expected_path_2) ;
125+ assert_eq ! ( & results[ 1 ] , & expected_2) ;
126+
127+ let expected_path_3 = temp
128+ . child ( "work" )
129+ . child ( "project3" )
130+ . child ( "target" )
131+ . path ( )
132+ . to_path_buf ( ) ;
133+ let expected_3 = ArtifactCandidate :: new ( expected_path_3) ;
134+ assert_eq ! ( & results[ 2 ] , & expected_3) ;
135+
136+ temp. close ( ) . unwrap ( ) ;
137+ }
98138}
You can’t perform that action at this time.
0 commit comments