Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Perl Misc (http://www.velocityreviews.com/forums/f67-perl-misc.html)
-   -   Can I use Test:Simple on a ::main package? (http://www.velocityreviews.com/forums/t897944-can-i-use-test-simple-on-a-main-package.html)

Derek Basch 05-12-2006 06:16 PM

Can I use Test:Simple on a ::main package?
 
Can I use Test:Simple on a ::main package? Every example I see
instantiate an existing module for testing. What if I wan't to test a
file/package that I am converting to a module?

Thanks,
Derek Basch


Derek Basch 05-12-2006 06:21 PM

Re: Can I use Test:Simple on a ::main package?
 
correction: "instantiates"


Derek Basch 05-12-2006 06:59 PM

Re: Can I use Test:Simple on a ::main package?
 
Well, I figured it out on my own. Here is an example that will maybe
help someone in the future:

use strict;
use Test::More;

BEGIN { plan tests => 2, todo => [0], onfail => sub { warn "Tests
Failed!" } }

require "banned_cc_interface.pl";

my $good_card;
$good_card = '1111111111111111';
my $bad_card;
$bad_card = '2222222222222222';

is(&is_banned($good_card), 0, "card # '1111111111111111 is not banned
and it should not be.");
is(&is_banned($bad_card), 1, "card # 2222222222222222 is banned and it
should be.");



All times are GMT. The time now is 12:49 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.