home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 December / PCpro_2006_12.ISO / ossdvd / server / Perl2 / lib / Class / isa / test.pl
Encoding:
Perl Script  |  2001-07-08  |  1.2 KB  |  41 lines

  1. BEGIN {
  2.     chdir 't' if -d 't';
  3.     @INC = '../lib';
  4. }
  5.  
  6. # Before `make install' is performed this script should be runnable with
  7. # `make test'. After `make install' it should work as `perl test.pl'
  8.  
  9. ######################### We start with some black magic to print on failure.
  10.  
  11. # Change 1..1 below to 1..last_test_to_print .
  12. # (It may become useful if the test is moved to ./t subdirectory.)
  13.  
  14. BEGIN { $| = 1; print "1..2\n"; }
  15. END {print "not ok 1\n" unless $loaded;}
  16. use Class::ISA;
  17. $loaded = 1;
  18. print "ok 1\n";
  19.  
  20. ######################### End of black magic.
  21.  
  22. # Insert your test code below (better if it prints "ok 13"
  23. # (correspondingly "not ok 13") depending on the success of chunk 13
  24. # of the test code):
  25.  
  26.   @Food::Fishstick::ISA = qw(Food::Fish  Life::Fungus  Chemicals);
  27.   @Food::Fish::ISA = qw(Food);
  28.   @Food::ISA = qw(Matter);
  29.   @Life::Fungus::ISA = qw(Life);
  30.   @Chemicals::ISA = qw(Matter);
  31.   @Life::ISA = qw(Matter);
  32.   @Matter::ISA = qw();
  33.  
  34.   use Class::ISA;
  35.   my @path = Class::ISA::super_path('Food::Fishstick');
  36.   my $flat_path = join ' ', @path;
  37.   print "# Food::Fishstick path is:\n# $flat_path\n";
  38.   print "not " unless
  39.    "Food::Fish Food Matter Life::Fungus Life Chemicals" eq $flat_path;
  40.   print "ok 2\n";
  41.