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. Advertisements

  2. Derek Basch

    Derek Basch Guest

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

  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. Advertisements

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. John M
    Replies:
    1
    Views:
    1,646
    Kumar Reddi
    May 29, 2005
  2. Robert Allan Schwartz
    Replies:
    7
    Views:
    597
    Marco Manfredini
    Aug 13, 2004
  3. Hal Styli
    Replies:
    14
    Views:
    2,083
    Old Wolf
    Jan 20, 2004
  4. Replies:
    2
    Views:
    392
    red floyd
    Apr 2, 2009
  5. Skybuck Flying

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

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    1,054
    Skybuck Flying
    Oct 4, 2009
  6. suresh
    Replies:
    16
    Views:
    4,016
    suresh
    Sep 8, 2010
  7. A.M-SG
    Replies:
    4
    Views:
    688
    Steven Cheng[MSFT]
    Oct 6, 2005
  8. monte
    Replies:
    7
    Views:
    194
    monte
    May 23, 2005
Loading...