background image
<< Mock Code | Isolate The Untestable Part >>
<< Mock Code | Isolate The Untestable Part >>
System call / Power manager example
System call / Power manager example
Say you have to test a power management daemon
One of the things it does is puts the computer to sleep
How do you test that?
sub should_i_sleep {
my($power_remaining) = @_;
system("/sbin/snooze") if $power_remaining < $Min_Power;
return 1;
}