Test AN::Tools

From AN!Wiki
Jump to: navigation, search

 AN!Tools :: AN::Tools :: Test AN::Tools

Note: For development, this is in a 'test.pl' file, not in 't/Tools.t'. When the modules reach release, this will be changed and the tests will be run by the Makefile.pl.

test.pl

#!/usr/bin/perl -Tw
#
# This is the test script for the AN::Tools family of modules.
# 
 
BEGIN {
	push @INC, "..";
}
 
# This just sets perl to be strict about how it runs.
use strict;
use warnings;
my $VERSION=0.0.001;
 
# Setup for UTF-8 mode.
# use utf8;
# binmode STDOUT, ":utf8:";
# $ENV{'PERL_UNICODE'}=1;
 
# Call in the test module
# use Test::More tests => 65;
use Test::More 'no_plan';
 
# Load my module via 'use_ok' test.
BEGIN
{
	print "Will now test AN::Tools on $^O.\n";
	use_ok('AN::Tools', 0.0.001);
}
 
# Test the main module object.e
# my $an=AN::Tools->new({String=>{force_utf8=>1}});
my $an=AN::Tools->new();
like($an, qr/^AN::Tools=HASH\(0x\w+\)$/, "AN::Tools object appears valid.");
my @methods=(
	"error", 
	"error_code", 
	"Alert", 
	"Math", 
	"Readable", 
	"String", 
	"data", 
	"_math_bigint_loaded", 
	"_load_math_bigint", 
	"_io_handle_loaded", 
	"_load_io_handle", 
	"_make_hash_reference", 
	"_add_hash_reference",
	"_error_limit",
	"_get_hash_reference"
);
can_ok("AN::Tools", @methods);
is($an->error(), "", "error() is initially blank.");
is($an->error_code(), 0, "error_code() is initially '0'.");
is($an->_math_bigint_loaded, 0, "_math_bigint_loaded() is initially '0'.");
 
### test AN::Tools::Alert
print "Testing AN::Tools::Alert\n";
require_ok("t/Alert.t");
 
### Test AN::Tools::Math
print "Testing AN::Tools::Math\n";
require_ok("t/Math.t");
 
### Test AN::Tools::Readable
print "Testing AN::Tools::Readable\n";
require_ok("t/Readable.t");
 
### Test AN::Tools::String
print "Testing AN::Tools::String\n";
require_ok("t/String.t");
 
exit 0;

 

Any questions, feedback, advice, complaints or meanderings are welcome.
Us: Alteeve's Niche! Support: Mailing List IRC: #clusterlabs on Freenode   © Alteeve's Niche! Inc. 1997-2019
legal stuff: All info is provided "As-Is". Do not use anything here unless you are willing and able to take responsibility for your own actions.
Personal tools
Namespaces

Variants
Actions
Navigation
projects
Toolbox