@@ -83,7 +83,9 @@ mod tests {
8383 } ;
8484 use crate :: sync:: {
8585 status:: { get_status, StatusType } ,
86- tests:: { debug_cmd_print, repo_init, repo_init_empty} ,
86+ tests:: {
87+ debug_cmd_print, get_statuses, repo_init, repo_init_empty,
88+ } ,
8789 utils:: { commit, stage_add_all, stage_add_file} ,
8890 } ;
8991 use std:: {
@@ -152,22 +154,14 @@ mod tests {
152154
153155 debug_cmd_print ( repo_path, "git status" ) ;
154156
155- assert_eq ! ( get_status( repo_path, StatusType :: Stage ) . len( ) , 1 ) ;
156- assert_eq ! (
157- get_status( repo_path, StatusType :: WorkingDir ) . len( ) ,
158- 1
159- ) ;
157+ assert_eq ! ( get_statuses( repo_path) , ( 1 , 1 ) ) ;
160158
161159 let res = reset_workdir_file ( repo_path, "bar.txt" ) ;
162160 assert_eq ! ( res, true ) ;
163161
164162 debug_cmd_print ( repo_path, "git status" ) ;
165163
166- assert_eq ! ( get_status( repo_path, StatusType :: Stage ) . len( ) , 1 ) ;
167- assert_eq ! (
168- get_status( repo_path, StatusType :: WorkingDir ) . len( ) ,
169- 0
170- ) ;
164+ assert_eq ! ( get_statuses( repo_path) , ( 0 , 1 ) ) ;
171165 }
172166
173167 #[ test]
@@ -186,20 +180,14 @@ mod tests {
186180
187181 debug_cmd_print ( repo_path, "git status" ) ;
188182
189- assert_eq ! (
190- get_status( repo_path, StatusType :: WorkingDir ) . len( ) ,
191- 1
192- ) ;
183+ assert_eq ! ( get_statuses( repo_path) , ( 1 , 0 ) ) ;
193184
194185 let res = reset_workdir_file ( repo_path, "foo/bar.txt" ) ;
195186 assert_eq ! ( res, true ) ;
196187
197188 debug_cmd_print ( repo_path, "git status" ) ;
198189
199- assert_eq ! (
200- get_status( repo_path, StatusType :: WorkingDir ) . len( ) ,
201- 0
202- ) ;
190+ assert_eq ! ( get_statuses( repo_path) , ( 0 , 0 ) ) ;
203191 }
204192
205193 #[ test]
@@ -233,21 +221,15 @@ mod tests {
233221 . write_all ( b"file3\n added line" ) ?;
234222 }
235223
224+ assert_eq ! ( get_statuses( repo_path) , ( 5 , 0 ) ) ;
225+
236226 stage_add_file ( repo_path, Path :: new ( "foo/file5.txt" ) ) ;
237227
238- assert_eq ! (
239- get_status( repo_path, StatusType :: WorkingDir ) . len( ) ,
240- 4
241- ) ;
242- assert_eq ! ( get_status( repo_path, StatusType :: Stage ) . len( ) , 1 ) ;
228+ assert_eq ! ( get_statuses( repo_path) , ( 4 , 1 ) ) ;
243229
244230 assert ! ( reset_workdir_folder( repo_path, "foo" ) ) ;
245231
246- assert_eq ! (
247- get_status( repo_path, StatusType :: WorkingDir ) . len( ) ,
248- 1
249- ) ;
250- assert_eq ! ( get_status( repo_path, StatusType :: Stage ) . len( ) , 1 ) ;
232+ assert_eq ! ( get_statuses( repo_path) , ( 1 , 1 ) ) ;
251233
252234 Ok ( ( ) )
253235 }
@@ -282,22 +264,14 @@ mod tests {
282264
283265 debug_cmd_print ( repo_path, "git status" ) ;
284266
285- assert_eq ! ( get_status( repo_path, StatusType :: Stage ) . len( ) , 1 ) ;
286- assert_eq ! (
287- get_status( repo_path, StatusType :: WorkingDir ) . len( ) ,
288- 1
289- ) ;
267+ assert_eq ! ( get_statuses( repo_path) , ( 1 , 1 ) ) ;
290268
291269 let res = reset_workdir_file ( repo_path, file) ;
292270 assert_eq ! ( res, true ) ;
293271
294272 debug_cmd_print ( repo_path, "git status" ) ;
295273
296- assert_eq ! (
297- get_status( repo_path, StatusType :: WorkingDir ) . len( ) ,
298- 0
299- ) ;
300- assert_eq ! ( get_status( repo_path, StatusType :: Stage ) . len( ) , 1 ) ;
274+ assert_eq ! ( get_statuses( repo_path) , ( 0 , 1 ) ) ;
301275 }
302276
303277 #[ test]
@@ -312,8 +286,14 @@ mod tests {
312286 . write_all ( b"test\n foo" )
313287 . unwrap ( ) ;
314288
289+ assert_eq ! ( get_statuses( repo_path) , ( 1 , 0 ) ) ;
290+
315291 assert_eq ! ( stage_add_file( repo_path, file_path) , true ) ;
316292
293+ assert_eq ! ( get_statuses( repo_path) , ( 0 , 1 ) ) ;
294+
317295 assert_eq ! ( reset_stage( repo_path, file_path) , true ) ;
296+
297+ assert_eq ! ( get_statuses( repo_path) , ( 1 , 0 ) ) ;
318298 }
319299}
0 commit comments