Can I use Test:Simple on a ::main package?

D

Derek Basch

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
 
D

Derek Basch

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.");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top