add new unit tests. These test the VCDisplay and HTMLpopup subsystems.

This commit is contained in:
kestes%walrus.com 2002-12-10 19:20:05 +00:00
parent 0951bcb9cb
commit 2825e167a3
2 changed files with 45 additions and 5 deletions

View File

@ -5,8 +5,8 @@
# current time.
# $Revision: 1.11 $
# $Date: 2002/05/10 21:17:56 $
# $Revision: 1.12 $
# $Date: 2002/12/10 19:20:05 $
# $Author: kestes%walrus.com $
# $Source: /home/hwine/cvs_conversion/cvsroot/mozilla/webtools/tinderbox2/src/test/gennotices.tst,v $
# $Name: $
@ -173,12 +173,22 @@ foreach $tree (@TREES) {
my ($pretty_time) = HTMLPopUp::timeHTML($timenow);
$associations = generate_associations();
# We simulate people posting notices for events older then the
# when they post the note.
my ($random_posttime) = rand 10;
$posttime = $timenow - ($random_posttime * 60),
$localposttime = localtime($posttime);
my (%data) = (
'tree' => $tree,
'mailaddr' => $mailaddr,
'note' => $note,
'time' => $timenow,
'localtime' => $localtimenow,
'posttime' => $posttime =$timenow,
'localposttime' => $localposttime,
'remote_host' => '127.0.0.1',
'associations' => $associations,
);

View File

@ -1,10 +1,10 @@
#!#perl# --
#!#perl# -w --
# generate static html pages for use in testing the popup libraries.
# $Revision: 1.1 $
# $Date: 2002/05/01 01:51:51 $
# $Revision: 1.2 $
# $Date: 2002/12/10 19:20:04 $
# $Author: kestes%walrus.com $
# $Source: /home/hwine/cvs_conversion/cvsroot/mozilla/webtools/tinderbox2/src/test/popup.tst,v $
# $Name: $
@ -204,3 +204,33 @@ foreach $popup_lib (@popup_libs) {
overwrite_file($outfile, $out);
}
{
# simple tests to validate the escape routines.
my $string = ' <A HREF="#1039471635" >12/09&nbsp;17:07</a> ';
my $urlescaped_string = HTMLPopUp::escapeURL($string);
my $htmlescaped_string = HTMLPopUp::escapeHTML($string);
my $url = HTMLPopUp::unescapeURL($urlescaped_string);
my $html = HTMLPopUp::unescapeHTML($htmlescaped_string);
($string eq $url) ||
die("escapeURL followed by unescapeURL did not give us original string\n");
($string eq $html) ||
die("escapeHTML followed by unescapeHTML did not give us original string\n");
($htmlescaped_string eq ' &lt;A HREF=&quot;#1039471635&quot; &gt;12/09&amp;nbsp;17:07&lt;/a&gt; ') ||
die("escapeHTML did not return expected string\n");
($urlescaped_string eq
'%20%3CA%20%20HREF%3D%22%231039471635%22%20%3E12%2F09%26nbsp%3B17%3A07%3C%2Fa%3E%20')
||
die("escapeURL did not return expected string\n");
}
1;