From: Grant M. <gr...@us...> - 2002-02-07 22:48:42
|
Update of /cvsroot/perl-xml/xml-simple/t In directory usw-pr-cvs1:/tmp/cvs-serv11170/t Modified Files: Tag: Release-1_06-maint 1_XMLin.t 3_Storable.t Log Message: Test updates Index: 1_XMLin.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/1_XMLin.t,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -d -r1.1.1.1 -r1.1.1.1.2.1 --- 1_XMLin.t 2 Dec 2001 15:51:25 -0000 1.1.1.1 +++ 1_XMLin.t 7 Feb 2002 22:48:38 -0000 1.1.1.1.2.1 @@ -107,8 +107,8 @@ eval "use XML::Simple;"; ok(1, !$@); # Module compiled OK -unless($XML::Simple::VERSION eq '1.06') { - print STDERR "Warning: XML::Simple::VERSION = $XML::Simple::VERSION (expected 1.06)..."; +unless($XML::Simple::VERSION eq '1.08') { + print STDERR "Warning: XML::Simple::VERSION = $XML::Simple::VERSION (expected 1.08)..."; } Index: 3_Storable.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/3_Storable.t,v retrieving revision 1.1.1.1 retrieving revision 1.1.1.1.2.1 diff -u -d -r1.1.1.1 -r1.1.1.1.2.1 --- 3_Storable.t 2 Dec 2001 15:51:35 -0000 1.1.1.1 +++ 3_Storable.t 7 Feb 2002 22:48:38 -0000 1.1.1.1.2.1 @@ -1,3 +1,5 @@ +# $Id$ + use strict; use File::Spec; @@ -203,25 +205,19 @@ ok(11, ! -e $XMLFile); # Original XML file is gone open(FILE, ">$XMLFile"); # Re-create it (empty) close(FILE); -utime($t1, $t1, $XMLFile); # but wind back the clock -$t0 = (stat($XMLFile))[9]; # Skip these tests if that didn't work -if($t0 == $t1) { - $opt = XMLin($XMLFile, cache => 'storable'); - ok(12, DataCompare($opt, $Expected)); # Got what we expected from the cache - ok(13, ! -s $XMLFile); # even though the XML file is empty -} -else { - print STDERR "no utime - skipping test 12..."; - ok(12, 1); - ok(13, 1); -} - +PassTime((stat($XMLFile))[9]); # But ensure cache file is newer +Storable::nstore($Expected, $CacheFile); +$opt = XMLin($XMLFile, cache => 'storable'); +ok(12, DataCompare($opt, $Expected)); # Got what we expected from the cache +ok(13, ! -s $XMLFile); # even though the XML file is empty +$t2 = (stat($CacheFile))[9]; PassTime($t2); -open(FILE, ">$XMLFile"); # Write some new data to the XML file +open(FILE, ">$XMLFile") || # Write some new data to the XML file + die "open(>$XMLFile): $!\n"; print FILE qq(<opt one="1" two="2"></opt>\n); close(FILE); -$opt = XMLin($XMLFile); # Parse with no caching +$opt = XMLin($XMLFile); # Parse with no caching ok(14, DataCompare($opt, { one => 1, two => 2})); # Got what we expected $t0 = (stat($CacheFile))[9]; # And timestamp on cache file my $s0 = (-s $CacheFile); |