Author: jkeenan Date: Tue Nov 13 14:10:19 2007 New Revision: 22819 Modified: trunk/lib/Parrot/Configure/Trace.pm trunk/t/postconfigure/05-trace.t
Log: Add a test for new method Parrot::Configure::Trace::diff_data_c(). Improve one older test in 05-trace.t. Minor POD changes in Trace.pm. Modified: trunk/lib/Parrot/Configure/Trace.pm ============================================================================== --- trunk/lib/Parrot/Configure/Trace.pm (original) +++ trunk/lib/Parrot/Configure/Trace.pm Tue Nov 13 14:10:19 2007 @@ -182,7 +182,7 @@ verbose => 1, # optional } ); - $attr = $obj->diff_data_c( { + $list_diff_steps = $obj->diff_data_c( { attr => 'some_attr', } ); Modified: trunk/t/postconfigure/05-trace.t ============================================================================== --- trunk/t/postconfigure/05-trace.t (original) +++ trunk/t/postconfigure/05-trace.t Tue Nov 13 14:10:19 2007 @@ -12,7 +12,7 @@ if ( ( -e qq{./lib/Parrot/Config/Generated.pm} ) and ( -e qq{./.configure_trace.sto} ) ) { - plan tests => 36; + plan tests => 38; } else { plan skip_all => q{Tests irrelevant unless configuration completed with tracing requested}; @@ -118,6 +118,14 @@ $steps_number, "trace_data_c() and list_steps() return same number of elements" ); $bad = 0; +my $list_diff_steps = $obj->diff_data_c( { attr => 'ccflags' } ); +is(ref($list_diff_steps), 'ARRAY', "diff_data_c returned array ref"); +for (my $i=0; $i <= $#$list_diff_steps; $i++) { + $bad++ if ref($list_diff_steps->[$i]) ne 'HASH'; +} +is($bad, 0, "Output of diff_data_c() is ref to array of hashrefs"); +$bad = 0; + foreach my $el ( @{$attr} ) { $bad++ unless ref($el) eq 'HASH'; } @@ -146,9 +154,13 @@ "With 'verbose', each element in array returned by trace_data_triggers() is hash ref" ); my @state; -ok( $state[0] = $obj->get_state_at_step(57), "get_state_at_step() returned true" ); -ok( $state[1] = $obj->get_state_at_step('gen::makefiles'), "get_state_at_step() returned true" ); -is_deeply( $state[0], $state[1], "Numeric and string arguments gave same result" ); +my $test_step = 'gen::makefiles'; +ok( $state[0] = $obj->get_state_at_step($index->{$test_step}), + "get_state_at_step() returned true" ); +ok( $state[1] = $obj->get_state_at_step($test_step), + "get_state_at_step() returned true" ); +is_deeply( $state[0], $state[1], + "Numeric and string arguments gave same result" ); my $state; eval { $state = $obj->get_state_at_step(0); };