@@ -130,8 +130,30 @@ mod tests {
130130 use super :: * ;
131131 use crate :: get_available_max_process_id;
132132
133+ #[ cfg( windows) ]
133134 #[ test]
134- fn kill_tree_available_max_process_id ( ) {
135+ fn kill_tree_available_max_process_id_windows ( ) {
136+ let target_process_id = get_available_max_process_id ( ) ;
137+ let result = kill_tree ( target_process_id) . expect ( "Failed to kill" ) ;
138+ assert_eq ! ( result. len( ) , 1 ) ;
139+ let output = & result[ 0 ] ;
140+ match output {
141+ crate :: Output :: Killed { .. } => {
142+ panic ! ( "This should not happen" ) ;
143+ }
144+ crate :: Output :: MaybeAlreadyTerminated { process_id, source } => {
145+ assert_eq ! ( * process_id, target_process_id) ;
146+ assert_eq ! (
147+ source. to_string( ) ,
148+ "Windows error: The parameter is incorrect. (0x80070057)"
149+ ) ;
150+ }
151+ }
152+ }
153+
154+ #[ cfg( unix) ]
155+ #[ test]
156+ fn kill_tree_available_max_process_id_unix ( ) {
135157 let target_process_id = get_available_max_process_id ( ) ;
136158 let result = kill_tree ( target_process_id) . expect ( "Failed to kill" ) ;
137159 assert_eq ! ( result. len( ) , 1 ) ;
@@ -147,8 +169,34 @@ mod tests {
147169 }
148170 }
149171
172+ #[ cfg( windows) ]
173+ #[ test]
174+ fn kill_tree_with_config_sigkill_available_max_process_id_windows ( ) {
175+ let target_process_id = get_available_max_process_id ( ) ;
176+ let config = Config {
177+ signal : String :: from ( "SIGKILL" ) ,
178+ ..Default :: default ( )
179+ } ;
180+ let result = kill_tree_with_config ( target_process_id, & config) . expect ( "Failed to kill" ) ;
181+ assert_eq ! ( result. len( ) , 1 ) ;
182+ let output = & result[ 0 ] ;
183+ match output {
184+ crate :: Output :: Killed { .. } => {
185+ panic ! ( "This should not happen" ) ;
186+ }
187+ crate :: Output :: MaybeAlreadyTerminated { process_id, source } => {
188+ assert_eq ! ( * process_id, target_process_id) ;
189+ assert_eq ! (
190+ source. to_string( ) ,
191+ "Windows error: The parameter is incorrect. (0x80070057)"
192+ ) ;
193+ }
194+ }
195+ }
196+
197+ #[ cfg( unix) ]
150198 #[ test]
151- fn kill_tree_with_config_sigkill_available_max_process_id ( ) {
199+ fn kill_tree_with_config_sigkill_available_max_process_id_unix ( ) {
152200 let target_process_id = get_available_max_process_id ( ) ;
153201 let config = Config {
154202 signal : String :: from ( "SIGKILL" ) ,
0 commit comments