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

Discussion in 'Perl Misc' started by Derek Basch, May 12, 2006.

  1. Derek Basch

    Derek Basch Guest

    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, May 12, 2006
    #1
    1. Advertising

  2. Derek Basch

    Derek Basch Guest

    correction: "instantiates"
     
    Derek Basch, May 12, 2006
    #2
    1. Advertising

  3. Derek Basch

    Derek Basch Guest

    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.");
     
    Derek Basch, May 12, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    329
    red floyd
    Apr 2, 2009
  2. Skybuck Flying

    Call oddities: &Test() vs &Test vs Test

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    762
    Skybuck Flying
    Oct 4, 2009
  3. suresh
    Replies:
    16
    Views:
    3,421
    suresh
    Sep 8, 2010
  4. A.M-SG
    Replies:
    4
    Views:
    473
    Steven Cheng[MSFT]
    Oct 6, 2005
  5. monte
    Replies:
    7
    Views:
    104
    monte
    May 23, 2005
Loading...

Share This Page