Test-Ranger

 view release on metacpan or  search on metacpan

lib/Test/Ranger.pm  view on Meta::CPAN

package Test::Ranger;

use 5.010000;
use strict;
use warnings;
use Carp;

use version 0.77; our $VERSION = qv('0.0.4');

use Test::More;                 # Standard framework for writing test scripts
use Data::Lock qw( dlock );     # Declare locked scalars, arrays, and hashes
use Scalar::Util;               # General-utility scalar subroutines
use Scalar::Util::Reftype;      # Alternate reftype() interface

use Test::Ranger::List;

## use

# Alternate uses
#~ use Devel::Comments;

#============================================================================#

# Pseudo-globals

#~ # Literal hash keys
#~ dlock( my $coderef     = '-coderef');    # cref to code under test

#----------------------------------------------------------------------------#

#=========# CLASS METHOD
#
#   my $obj     = $class->new($self);
#   my $obj     = $class->new();
#   my $obj     = $class->new({ -a  => 'x' });
#   my $obj     = $class->new([ 1, 2, 3, 4 ]);
#       
# Purpose   : Object constructor
# Parms     : $class    : Any subclass of this class
#           : $self     : Hashref or arrayref
# Returns   : $self
# Invokes   : init(), Test::Ranger::List::new()
# 
# If invoked with $class only, blesses and returns an empty hashref. 
# If invoked with $class and a hashref, blesses and returns it. 
# If invoked with $class and an arrayref, invokes ::List::new(). 
# 
sub new {
    my $class   = shift;
    my $self    = shift || {};      # default: hashref
    
    if ( (reftype $self)->array ) {
        $self       = Test::Ranger::List->new($self);
    } 
    else {
        bless ($self => $class);
        $self->init();
    };
    
    return $self;
}; ## new

#=========# OBJECT METHOD
#
#   $obj->init();
#
# Purpose   : Initialize housekeeping info.
# Parms     : $class    : Any subclass of this class
#           : $self     : Hashref
# Returns   : $self
#
sub init {
    my $self        = shift;
    
    $self->{-plan_counter}      = 0;
    $self->{-expanded}          = 0;
    
    return $self;
}; ## init

#=========# OBJECT METHOD
#
#   $single->expand();
#
# Purpose   : Expand/parse declaration into canonical form.
# Parms     : $class
#           : $self
# Returns   : $self
#
sub expand {
    my $self        = shift;
    
    # Default givens
    if ( !$self->{-given}{-args} ) {
        $self->{-given}{-args}     = [];
    };
    
    # Default expectations
    if ( !$self->{-return}{-want} ) {
        $self->{-return}{-want}     = 1;
    };
    
    
    
    $self->{-expanded}          = 1;
    
    return $self;
}; ## expand

#=========# OBJECT METHOD
#
#   $single->execute();
#
#       Execute a $single object.
#
sub execute {



( run in 0.676 second using v1.01-cache-2.11-cpan-39bf76dae61 )