Test::Trap::Builder

Test::Trap::Builder is a backend for building test traps.
Download

Test::Trap::Builder Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Eirik Berg Hanssen
  • Publisher web site:
  • http://search.cpan.org/~ebhanssen/Test-Trap-v0.0.23/lib/Test/Trap/Builder.pm

Test::Trap::Builder Tags


Test::Trap::Builder Description

Test::Trap::Builder is a backend for building test traps. Test::Trap::Builder is a backend for building test traps.SYNOPSIS package My::Test::Trap; use Test::Trap::Builder; my $B = Test::Trap::Builder->new; $B->layer( $layer_name => &layer_implementation ); $B->accessor( simple => ); $B->multi_layer( $multi_name => @names ); $B->test_method( $test_name => 0, $name_index, &test_function );Test::Trap's standard trap layers don't trap everything you might want to trap. So, Test::Trap::Builder provides methods to write your own trap layers -- preferrably for use with your own test trap module.Note that layers are methods with mangled names (names are prefixed with layer:), and so inherited like any other method.EXPORTSTest trap modules should not inherit from Test::Trap::Builder, but may import a few convenience methods for use in layer implementations. Layers should be implemented as methods, and while they need not call these convenience methods in turn, that likely makes for more readable code than any alternative.Do not use them as methods of Test::Trap::Builder -- they are intended to be methods of test trap objects, and won't work otherwise. In fact, they should probably not be called outside of layer implementations.RunA terminating layer may call this method to run the user code.NextEvery non-terminating layer should call this method (or an equivalent) to progress to the next layer. Note that this method need not return, so any teardown actions should probably be registered with the Teardown method (see below).Teardown SUBSIf your layer wants to clean up its setup, it may use this method to register any number of teardown actions, to be performed (in reverse registration order) once the user code has been executed.Exception STRINGSLayer implementations may run into exceptional situations, in which they want the entire trap to fail. Unfortunately, another layer may be trapping ordinary exceptions, so you need some kind of magic in order to throw an untrappable exception. This is one convenient way.Note: The Exception method won't work if called from outside of the regular control flow, like inside a DESTROY method or signal handler. If anything like this happens, CORE::exit will be called with an exit code of 8.TestAccessorReturns the name with index (if any) of the accessor for which the current test implementation is called.Requirements:· Perl


Test::Trap::Builder Related Software