Browse Source

Total Test Overhaul! Most of these were stubs, and still are.

Input.t was replaced because it tested a now obsolete function.
Input.pm has that function commented out.
Several files were renamed to match their counterparts or
correct misspellingz.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
3.0.x
Joe Atzberger 17 years ago
committed by Joshua Ferraro
parent
commit
a1fe32d2f8
  1. 62
      C4/Input.pm
  2. 19
      t/Accounts.t
  3. 32
      t/Acquisition.t
  4. 19
      t/Amazon.t
  5. 19
      t/Auth.t
  6. 17
      t/Auth_with_ldap.t
  7. 5
      t/AuthoritesMarc.t
  8. 14
      t/AuthoritiesMarc.t
  9. 19
      t/Barcodes_PrinterConfig.t
  10. 19
      t/Biblio.t
  11. 19
      t/Bookfund.t
  12. 19
      t/Bookseller.t
  13. 3
      t/Boolean.t
  14. 19
      t/Branch.t
  15. 19
      t/Breeding.t
  16. 19
      t/Calendar.t
  17. 5
      t/Charset.t
  18. 19
      t/Circulation.t
  19. 19
      t/Context.t
  20. 0
      t/Date.t
  21. 9
      t/Dates.t
  22. 59
      t/Input.t
  23. 0
      t/Koha.t
  24. 19
      t/Labels.t
  25. 19
      t/Languages.t
  26. 19
      t/Letters.t
  27. 19
      t/Log.t
  28. 19
      t/Maintainance.t
  29. 19
      t/Members.t
  30. 19
      t/NewsChannels.t
  31. 0
      t/Output.t
  32. 19
      t/Overdues.t
  33. 19
      t/Print.t
  34. 19
      t/Record.t
  35. 19
      t/Reserves.t
  36. 19
      t/Review.t
  37. 19
      t/Search.t
  38. 19
      t/Serials.t
  39. 19
      t/Stats.t
  40. 19
      t/Suggestions.t
  41. 0
      t/VirtualShelves.t
  42. 19
      t/Z3950.t
  43. 0
      t/dummy.t
  44. 282
      t/output.t

62
C4/Input.pm

@ -62,13 +62,13 @@ checkdigit at the end of C<$cardnumber>. Returns a true value iff
C<$cardnumber> has a valid check digit.
=cut
#'
sub checkdigit {
sub checkdigit ($;$) {
my ($infl, $nounique) = @_;
$infl = uc $infl;
# Check to make sure the cardnumber is unique
#FIXME: We should make the error for a nonunique cardnumber
@ -77,9 +77,8 @@ sub checkdigit {
unless ( $nounique )
{
my $dbh=C4::Context->dbh;
my $query=qq{SELECT * FROM borrowers WHERE cardnumber=?};
my $sth=$dbh->prepare($query);
my $sth=C4::Context->prepare($query);
$sth->execute($infl);
my %results = $sth->fetchrow_hashref();
if ( $sth->rows != 0 )
@ -93,10 +92,7 @@ sub checkdigit {
my @weightings = (8,4,6,3,5,2,1);
my $sum;
my $i = 1;
my $valid = 0;
foreach $i (1..7) {
foreach my $i (1..7) {
my $temp1 = $weightings[$i-1];
my $temp2 = substr($infl,$i,1);
$sum += $temp1 * $temp2;
@ -106,12 +102,12 @@ sub checkdigit {
$rem = "X";
}
if ($rem eq substr($infl,8,1)) {
$valid = 1;
return 1;
}
return $valid;
return 0;
} # sub checkdigit
=item checkvalidisbn
=item checkvalidisbn # Obsolete Function!
$valid = &checkvalidisbn($isbn);
@ -119,41 +115,23 @@ Returns a true value iff C<$isbn> is a valid ISBN: it must be ten
digits long (counting "X" as a digit), and must have a valid check
digit at the end.
=cut
#'
#--------------------------------------
# Determine if a number is a valid ISBN number, according to length
# of 10 digits and valid checksum
sub checkvalidisbn {
use strict;
my ($q)=@_ ; # Input: ISBN number
my $isbngood = 0; # Return: true or false
$q=~s/x$/X/g; # upshift lower case X
$q=~s/[^X\d]//g;
$q=~s/X.//g;
#return 0 if $q is not ten digits long
if (length($q)!=10) {
return 0;
}
#If we get to here, length($q) must be 10
my $checksum=substr($q,9,1);
my $isbn=substr($q,0,9);
my $i;
sub checkvalidisbn ($) { # Obsolete Function!
my ($q) = shift or return undef;
$q=~s/[^Xx\d]//g;
/(\d{9})(X|\d)/i or
/(\d{12})(X|\d)/i or return 0;
my $checksum = $2;
my $isbn = $1;
my $c = 0;
for ($i=0; $i<9; $i++) {
my $max = length $isbn;
for (my $i=0; $i<$max; $i++) {
my $digit=substr($q,$i,1);
$c+=$digit*(10-$i);
}
$c %= 11;
($c==10) && ($c='X');
$isbngood = $c eq $checksum;
return $isbngood;
} # sub checkvalidisbn
($c==10) and $c = 'X';
return ($c eq $checksum) ? 1 : 0;
}
=item buildCGISort
@ -163,8 +141,8 @@ Returns the scrolling list with name $input_name, built on authorised Values nam
Returns NULL if no authorised values found
=cut
sub buildCGIsort {
use strict;
my ($name,$input_name,$data) = @_;
my $dbh=C4::Context->dbh;
my $query=qq{SELECT * FROM authorised_values WHERE category=? order by lib};

19
t/Accounts.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Accounts;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Accounts');
}

32
t/Acquisition.t

@ -1,20 +1,18 @@
BEGIN { $| = 1; print "1..3\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Acquisition;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
$basketno=NewBasket(1,1);
if ($basketno){
print "ok 2\n";
}
else {
print "not ok 2\n";
}
use strict;
use warnings;
if ($basket=GetBasket($basketno)){
print "ok 3\n";
}
else {
print "not ok 3\n";
use Test::More tests => 3;
BEGIN {
use_ok('C4::Acquisition');
}
my ($basket, $basketno);
ok($basketno = NewBasket(1,1), "NewBasket( 1 , 1 ) returns $basketno");
ok($basket = GetBasket($basketno), "GetBasket($basketno) returns $basket");

19
t/Amazon.t

@ -1,7 +1,14 @@
# Basic compile test only at this stage, needs to be fleshed out
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Amazon');
}
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Amazon;
$loaded = 1;
print "ok 1\n";

19
t/Auth.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Auth;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Auth');
}

17
t/Auth_with_ldap.t

@ -1,5 +1,12 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Auth_with_ldap;
$loaded = 1;
print "ok 1\n";
#!/bin/perl
#
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Auth_with_ldap');
}

5
t/AuthoritesMarc.t

@ -1,5 +0,0 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::AuthoritiesMarc;
$loaded = 1;
print "ok 1\n";

14
t/AuthoritiesMarc.t

@ -0,0 +1,14 @@
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::AuthoritiesMarc');
}

19
t/Barcodes_PrinterConfig.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Barcodes::PrinterConfig;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Barcodes::PrinterConfig');
}

19
t/Biblio.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Biblio;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Biblio');
}

19
t/Bookfund.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Bookfund;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Bookfund');
}

19
t/Bookseller.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Bookseller;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Bookseller');
}

3
t/Boolean.t

@ -1,3 +1,6 @@
#!/usr/bin/perl
#
use strict;
use C4::Boolean;

19
t/Branch.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Branch;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Branch');
}

19
t/Breeding.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Breeding;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Breeding');
}

19
t/Calendar.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Calendar;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Calendar');
}

5
t/Charset.t

@ -1,5 +1,8 @@
#!/usr/bin/perl
#
use strict;
use C4::Interface::CGI::Output;
use C4::Interface::CGI::Output; #
use vars qw( @tests );
use vars qw( $loaded );

19
t/Circulation.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Circulation;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Circulation');
}

19
t/Context.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Context;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Context');
}

0
t/Date.t

9
t/Dates.t

@ -1,4 +1,7 @@
#!/bin/perl
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 91;
BEGIN {
@ -13,7 +16,7 @@ my %thash = (
'19890921 143907' ],
);
my ($today, $today0, $val, $re, $syspref);
my ($date, $format, $today, $today0, $val, $re, $syspref);
my @formats = sort keys %thash;
diag "\n Testing Legacy Functions: format_date and format_date_in_iso";
ok($syspref = C4::Dates->new->format(), "Your system preference is: $syspref");
@ -38,7 +41,7 @@ foreach (@formats) {
}
diag "\nTesting with inputs:\n";
foreach my $format (@formats) {
foreach $format (@formats) {
my $pre = sprintf '(%-6s)', $format;
foreach my $testval (@{$thash{ $format }}) {
ok($date = C4::Dates->new($testval,$format), "$pre Date Creation : new('$testval','$format')");

59
t/Input.t

@ -1,55 +1,14 @@
# $Id$
#use strict;
BEGIN { $| = 1; print "1..13\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Input;
$loaded = 1;
print "ok 1\n";
my $TestCount=1;
#-----------------
# Test ISBN validation
my $isbn;
# Good numbers
foreach $isbn ('0836213092','087784805X','087784805x','1878685899') {
PrintNextTestResult ( &checkvalidisbn($isbn), "Good ISBN: $isbn" )
}
# Bad numbers
foreach $isbn ('0836213192','087784804X','087784806x','1878685898',
'', ' ', 'abc', '1234567890123') {
PrintNextTestResult ( ! &checkvalidisbn($isbn), "Bad ISBN: $isbn" )
}
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
#-----------------------
sub PrintNextTestResult {
# modifies global var $TestCount
my ($ThisTestResult, $TestComment )=@_;
use strict;
use warnings;
$TestCount++;
use Test::More tests => 1;
if ( $ThisTestResult ) {
print "ok $TestCount\n";
} else {
print STDERR "\nTest failed: $TestComment\n";
print "not ok $TestCount\n";
BEGIN {
use_ok('C4::Input');
}
} # sub PrintNextTestResult
#-----------------------
# $Log$
# Revision 1.2 2002/06/20 18:18:06 tonnesen
# 47 files to go, 47 files to go, take one down, pass it around...
# 46 files to go.
#
# Revision 1.1.2.1 2002/06/20 15:19:34 amillar
# Test valid ISBN numbers in Input.pm
#

0
t/koha.t → t/Koha.t

19
t/Labels.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Labels;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Labels');
}

19
t/Languages.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Languages;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Languages');
}

19
t/Letters.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Letters;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Letters');
}

19
t/Log.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Log;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Log');
}

19
t/Maintainance.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Maintainance;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Maintainance');
}

19
t/Members.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Members;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Members');
}

19
t/NewsChannels.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::NewsChannels;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::NewsChannels');
}

0
t/Output.t

19
t/Overdues.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Overdues;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Overdues');
}

19
t/Print.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Print;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Print');
}

19
t/Record.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Record;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Record');
}

19
t/Reserves.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Reserves;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Reserves');
}

19
t/Review.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Accounts;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Review');
}

19
t/Search.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Search;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Search');
}

19
t/Serials.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Serials;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Serials');
}

19
t/Stats.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Stats;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Stats');
}

19
t/Suggestions.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Suggestions;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Suggestions');
}

0
t/VirtualShelves.t

19
t/Z3950.t

@ -1,5 +1,14 @@
BEGIN { $| = 1; print "1..1\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Z3950;
$loaded = 1;
print "ok 1\n";
#!/usr/bin/perl
#
# This Koha test module is a stub!
# Add more tests here!!!
use strict;
use warnings;
use Test::More tests => 1;
BEGIN {
use_ok('C4::Z3950');
}

0
t/dummy.t

282
t/output.t

@ -1,282 +0,0 @@
BEGIN { $| = 1; print "1..25\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Output;
$loaded = 1;
print "ok 1\n";
#
# ensure &startpage returns correct value
#
if ("<html>\n" eq startpage()) {
print "ok 2\n";
} else {
print "not ok 2\n";
}
#
# Check that &gotopage returns proper value
#
if ("<META HTTP-EQUIV=Refresh CONTENT=\"0;URL=http:foo\">" eq gotopage('foo')) {
print "ok 3\n";
} else {
print "not ok 3\n";
}
#
# skipping &startmenu for now
#
#
# skipping &endmenu for now
#
# ensure &mktablehdr returns a proper value
#
if ("<table border=0 cellspacing=0 cellpadding=5>\n" eq mktablehdr()) {
print "ok 4\n";
} else {
print "not ok 4\n";
}
#
# ensure &mktablerow returns a proper value
#
# 1 row, no background image
if ("<tr valign=top bgcolor=red><td>text</td></tr>\n" eq
mktablerow(1,'red','text')) {
print "ok 5\n";
} else {
print "not ok 5\n";
}
# 1 row, background image
if ("<tr valign=top bgcolor=red><td background=\"foo.jpg\">text</td></tr>\n" eq
mktablerow(1,'red','text','foo.jpg')) {
print "ok 6\n";
} else {
print "not ok 6\n";
}
#2 rows, no background image
if ("<tr valign=top bgcolor=red><td>text</td><td>text</td></tr>\n" eq
mktablerow(2,'red','text','text')) {
print "ok 7\n";
} else {
print "not ok 7\n";
}
# 2 rows, background image
if ("<tr valign=top bgcolor=red><td background=\"foo.jpg\">text</td><td background=\"foo.jpg\">text</td></tr>\n" eq
mktablerow(2,'red','text','text', 'foo.jpg')) {
print "ok 8\n";
} else {
print "not ok 8\n";
}
#
# ensure mktableft returns the proper value
#
if ("</table>\n" eq mktableft()) {
print "ok 9\n";
} else {
print "not ok 9\n";
}
#
# skipping mkform for now
#
#
# skipping mkform3 for now
#
#
# skipping mkform2 for now
#
#
# ensure endpage returns the proper value
#
if ("</body></html>\n" eq endpage()) {
print "ok 10\n";
} else {
print "not ok 10\n";
}
#
# ensure mklink returns the right value
#
if ("<a href=\"foo.html\">foo</a>" eq mklink('foo.html', 'foo')) {
print "ok 11\n";
} else {
print "not ok 11\n";
}
#
# ensure mkheadr returns the proper value
#
if ("<FONT SIZE=6><em>foo</em></FONT><br>" eq mkheadr(1,'foo')) {
print "ok 12\n";
} else {
print "not ok 12\n";
}
if ("<FONT SIZE=6><em>foo</em></FONT>" eq mkheadr(2,'foo')) {
print "ok 13\n";
} else {
print "not ok 13\n";
}
if ("<FONT SIZE=6><em>foo</em></FONT><p>" eq mkheadr(3,'foo')) {
print "ok 14\n";
} else {
print "not ok 14\n";
}
#
# test &center and &endcenter
#
if ("<CENTER>\n" eq center()) {
print "ok 15\n";
} else {
print "not ok15\n";
}
if ("</CENTER>\n" eq endcenter()) {
print "ok 16\n";
} else {
print "not ok 16\n";
}
#
# ensure bold returns proper value
#
if ("<b>foo</b>" eq bold('foo')) {
print "ok 17\n";
} else {
print "not ok\n";
}
#
# ensure &mkformnotable returns a valid value
#
@inputHidden = qw(hidden hiddenname hiddenvalue);
@inputRadio = qw(radio radioname radiovalue);
@inputText = qw(text textname textvalue);
@inputTextarea = qw(textarea textareaname textareavalue);
@inputSubmit = qw(submit submitname submitvalue);
@inputReset = qw(reset resetname resetvalue);
# 1 input; hidden
@inputs = (\@inputHidden);
$return ="<form action=actionurl method=post>\n";
$return .= "<input type=hidden name=hiddenname value=\"hiddenvalue\">\n";
$return .= "</form>";
if ($return eq mkformnotable('actionurl', @inputs)) {
print "ok 18\n";
} else {
print "not ok 18\n";
}
# 1 input; radio
@inputs = (\@inputRadio);
$return ="<form action=actionurl method=post>\n";
$return .= "<input type=radio name=radioname value=\"radiovalue\">radiovalue\n";
$return .= "</form>";
if ($return eq mkformnotable('actionurl', @inputs)) {
print "ok 19\n";
} else {
print "not ok 19\n";
}
# 1 input; text
@inputs = (\@inputText);
$return = "<form action=actionurl method=post>\n";
$return .= "<input type=text name=textname value=\"textvalue\">\n";
$return .= "</form>";
if ($return eq mkformnotable('actionurl', @inputs)) {
print "ok 20\n";
} else {
print "not ok 20\n";
}
# 1 input; textarea
@inputs = (\@inputTextarea);
$return = "<form action=actionurl method=post>\n";
$return .= "<textarea name=textareaname wrap=physical cols=40 rows=4>textareavalue</textarea>\n";
$return .= "</form>";
if ($return eq mkformnotable('actionurl', @inputs)) {
print "ok 21\n";
} else {
print "not ok 21\n";
}
# 1 input; submit
@inputs = (\@inputSubmit);
$return = "<form action=actionurl method=post>\n";
$return .= "<input type=submit name=submitname value=\"submitvalue\">\n";
$return .= "</form>";
if ($return eq mkformnotable('actionurl', @inputs)) {
print "ok 22\n";
} else {
print "not ok 22\n";
}
# 1 input; reset
@inputs = (\@inputReset);
$return = "<form action=actionurl method=post>\n";
$return .= "<input type=reset name=resetname value=\"resetvalue\">\n";
$return .= "</form>";
if ($return eq mkformnotable('actionurl', @inputs)) {
print "ok 23\n";
} else {
print "not ok 23\n";
}
# 2 inputs; hidden and submit
@inputs = (\@inputHidden, \@inputSubmit);
$return = "<form action=actionurl method=post>\n";
$return .= "<input type=hidden name=hiddenname value=\"hiddenvalue\">\n";
$return .= "<input type=submit name=submitname value=\"submitvalue\">\n";
$return .= "</form>";
if ($return eq mkformnotable('actionurl', @inputs)) {
print "ok 24\n";
} else {
print "not ok 24\n";
}
# 3 inputs; text, submit, and reset
@inputs = (\@inputText, \@inputSubmit, \@inputReset);
$return = "<form action=actionurl method=post>\n";
$return .= "<input type=text name=textname value=\"textvalue\">\n";
$return .= "<input type=submit name=submitname value=\"submitvalue\">\n";
$return .= "<input type=reset name=resetname value=\"resetvalue\">\n";
$return .= "</form>";
if ($return eq mkformnotable('actionurl', @inputs)) {
print "ok 25\n";
} else {
print "not ok 25\n";
}
Loading…
Cancel
Save