home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2006 December / PCpro_2006_12.ISO / ossdvd / server / Perl2 / lib / Locale / Maketext / test.pl < prev    next >
Encoding:
Text File  |  2001-07-08  |  1.4 KB  |  62 lines

  1. # Before `make install' is performed this script should be runnable with
  2. # `make test'. After `make install' it should work as `perl test.pl'
  3. # Time-stamp: "2001-06-20 02:12:53 MDT"
  4. ######################### We start with some black magic to print on failure.
  5.  
  6. # (It may become useful if the test is moved to ./t subdirectory.)
  7.  
  8. BEGIN { $| = 1; print "1..5\n"; }
  9. END {print "fail 1\n" unless $loaded;}
  10. use Locale::Maketext 1.01;
  11. print "# Perl v$], Locale::Maketext v$Locale::Maketext::VERSION\n";
  12. $loaded = 1;
  13. print "ok 1\n";
  14. {
  15.   package Woozle;
  16.   @ISA = ('Locale::Maketext');
  17.   sub dubbil   { return $_[1] * 2 }
  18.   sub numerate { return $_[2] . 'en' }
  19. }
  20. {
  21.   package Woozle::elx;
  22.   @ISA = ('Woozle');
  23.   %Lexicon = (
  24.    'd2' => 'hum [dubbil,_1]',
  25.    'd3' => 'hoo [quant,_1,zaz]',
  26.    'd4' => 'hoo [*,_1,zaz]',
  27.   );
  28. }
  29.  
  30. $lh = Woozle->get_handle('elx');
  31. if($lh) {
  32.   print "ok 2\n";
  33.  
  34.   my $x;
  35.  
  36.   $x = $lh->maketext('d2', 7);
  37.   if($x eq "hum 14") {
  38.     print "ok 3\n";
  39.   } else {
  40.     print "fail 3 #  (got \"$x\")\n";
  41.   }
  42.  
  43.   $x = $lh->maketext('d3', 7);
  44.   if($x eq "hoo 7 zazen") {
  45.     print "ok 4\n";
  46.   } else {
  47.     print "fail 4 #  (got \"$x\")\n";
  48.   }
  49.  
  50.   $x = $lh->maketext('d4', 7);
  51.   if($x eq "hoo 7 zazen") {
  52.     print "ok 5\n";
  53.   } else {
  54.     print "fail 5 #  (got \"$x\")\n";
  55.   }
  56.  
  57.   
  58. } else {
  59.   print "fail 2\n";
  60. }
  61. #Shazam!
  62.