]> git.donarmstrong.com Git - deb_pkgs/libhtml-calendarmonth-perl.git/blobdiff - t/testload.pm
* Add 1.18 HTML::CalendarMonth upgrade
[deb_pkgs/libhtml-calendarmonth-perl.git] / t / testload.pm
index 902069dc854e6120204cdb38236f98f08abd140c..cfb25461c66926d8924f4d24788b031ab27fc30e 100644 (file)
@@ -9,7 +9,7 @@ my $DEBUG = 0;
 
 require Exporter;
 @ISA = qw(Exporter);
-@EXPORT = qw( $Dat_Dir check_datetool
+@EXPORT = qw( $Dat_Dir check_datetool case_count
               check_basic_with_datetool
               check_woy_with_datetool
             );
@@ -19,21 +19,23 @@ use File::Spec;
 use HTML::CalendarMonth;
 use HTML::CalendarMonth::DateTool;
 
-my $base_dir;
+my($base_dir, $vol, $dir);
 BEGIN {
   my $pkg = __PACKAGE__;
   $pkg =~ s%::%/%g;
   $pkg .= '.pm';
   $pkg = File::Spec->canonpath($INC{$pkg});
-  $pkg =~ s/\/[^\/]+\.pm$//;
-  $base_dir = $pkg;
+  my $file;
+  ($vol, $dir, $file) = File::Spec->splitpath($pkg);
+  $base_dir = File::Spec->catpath($vol, $dir);
 }
 $Dat_Dir = $base_dir;
 
 my($tcount, $rds, %dates, @tmethods, @twy_methods, @Cals);
 
 # Required test dates
-open(D, "$Dat_Dir/test.dat") or die "Problem reading $Dat_Dir/test.dat: $!\n";
+my $dat_file = File::Spec->catpath($vol, $dir, 'test.dat');
+open(D, "<$dat_file") or die "Problem reading $dat_file: $!\n";
 $rds = <D>;
 foreach (split(' ', $rds)) {
   ++$dates{$_};
@@ -66,6 +68,8 @@ while (<D>) {
 
 close(D);
 
+sub case_count { scalar @Cals }
+
 sub check_datetool {
   my $datetool = shift;
   my $module = HTML::CalendarMonth::DateTool->toolmap($datetool);