QUICK OBJECTS
- Quick objects were concieved as an api stand-in
- Emulates objects that provide fairly static information
- Useful when the information in the object is not relivant to the test
An example function to test:
sub add_and_append {
my ( $numA, $numB, $subsystem ) = @_;
my $sum = $numA + $numB;
return $subsystem->system_name . ":" . $sum;
}
- We only want to test the addition, and the appending
- We do not really care what subsystem->system_name returns (tested elsware)
- Subsystem->new() needs 20 arguments, all are used to by system_name()
Thats where quick objects come in:
is(
add_and_append( 2, 3, qobj( system_name => 'foo' )),
"foo:5",
"add_and_append works"
);