r4332 - in /packages/libcalendar-simple-perl: ./ branches/ branches/upstream/ branches/upstream/current/ branches/upstream/current/bin/ branches/upstream/current/lib/ branches/upstream/current/lib/Calendar/ branches/upstream/current/t/ tags/

eloy at users.alioth.debian.org eloy at users.alioth.debian.org
Wed Nov 22 11:44:28 CET 2006


Author: eloy
Date: Wed Nov 22 11:44:28 2006
New Revision: 4332

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=4332
Log:
[svn-inject] Installing original source of libcalendar-simple-perl

Added:
    packages/libcalendar-simple-perl/
    packages/libcalendar-simple-perl/branches/
    packages/libcalendar-simple-perl/branches/upstream/
    packages/libcalendar-simple-perl/branches/upstream/current/
    packages/libcalendar-simple-perl/branches/upstream/current/Build.PL   (with props)
    packages/libcalendar-simple-perl/branches/upstream/current/COPYING
    packages/libcalendar-simple-perl/branches/upstream/current/Changes
    packages/libcalendar-simple-perl/branches/upstream/current/MANIFEST   (with props)
    packages/libcalendar-simple-perl/branches/upstream/current/META.yml
    packages/libcalendar-simple-perl/branches/upstream/current/Makefile.PL
    packages/libcalendar-simple-perl/branches/upstream/current/README
    packages/libcalendar-simple-perl/branches/upstream/current/SIGNATURE
    packages/libcalendar-simple-perl/branches/upstream/current/bin/
    packages/libcalendar-simple-perl/branches/upstream/current/bin/pcal   (with props)
    packages/libcalendar-simple-perl/branches/upstream/current/lib/
    packages/libcalendar-simple-perl/branches/upstream/current/lib/Calendar/
    packages/libcalendar-simple-perl/branches/upstream/current/lib/Calendar/Simple.pm   (with props)
    packages/libcalendar-simple-perl/branches/upstream/current/t/
    packages/libcalendar-simple-perl/branches/upstream/current/t/date_span.t
    packages/libcalendar-simple-perl/branches/upstream/current/t/no_dt.t   (with props)
    packages/libcalendar-simple-perl/branches/upstream/current/t/pod.t   (with props)
    packages/libcalendar-simple-perl/branches/upstream/current/t/pod_coverage.t
    packages/libcalendar-simple-perl/branches/upstream/current/t/test.t   (with props)
    packages/libcalendar-simple-perl/tags/

Added: packages/libcalendar-simple-perl/branches/upstream/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/Build.PL?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/Build.PL (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/Build.PL Wed Nov 22 11:44:28 2006
@@ -1,0 +1,15 @@
+use Module::Build;
+
+my $build = Module::Build->new(
+                               dist_author => 'Dave Cross <dave at dave.org.uk',
+                               module_name => 'Calendar::Simple',
+                               license     => 'perl',
+                               requires    => {
+                                               Test::More => 0,
+                                              },
+                               create_makefile_pl => 'traditional',
+                               script_files => [ 'bin/pcal' ],
+                               sign        => 1,
+                              );
+
+$build->create_build_script;

Propchange: packages/libcalendar-simple-perl/branches/upstream/current/Build.PL
------------------------------------------------------------------------------
    svn:executable = 

Added: packages/libcalendar-simple-perl/branches/upstream/current/COPYING
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/COPYING?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/COPYING (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/COPYING Wed Nov 22 11:44:28 2006
@@ -1,0 +1,6 @@
+COPYRIGHT
+
+Copyright (C) 2002, Dave Cross.  All Rights Reserved.
+
+This script is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.

Added: packages/libcalendar-simple-perl/branches/upstream/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/Changes?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/Changes (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/Changes Wed Nov 22 11:44:28 2006
@@ -1,0 +1,123 @@
+2005-05-31 18:52  dave
+
+	* Build.PL, lib/Calendar/Simple.pm: Fixes to Build.PL.
+	  Small changes to Pod.
+
+2005-03-01 14:31  dave
+
+	* lib/Calendar/Simple.pm: Adding pod coverage tests
+
+2005-03-01 14:23  dave
+
+	* MANIFEST, t/no_dt.t, t/pod_coverage.t, t/test.t: Added pod
+	  coverage tests
+
+2004-12-04 11:46  dave
+
+	* lib/Calendar/Simple.pm: Added 'see also' reference to DateTime
+
+2004-12-04 11:44  dave
+
+	* t/test.t: Don't run 2100 test if DateTime isn't installed
+
+2004-10-30 19:08  dave
+
+	* lib/Calendar/Simple.pm: Moved Simple.pm
+
+2004-10-30 19:06  dave
+
+	* Build.PL, MANIFEST, Makefile.PL: Removed Makefile.PL (now
+	  generated by Build.PL)
+	  Added Build.PL
+	  Updated MANIFEST
+
+2004-10-23 09:04  dave
+
+	* lib/Calendar/Simple.pm, t/no_dt.t, t/pod.t, t/test.t: Improved
+	  test coverage
+
+2004-05-23 09:32  dave
+
+	* README, README.xml: Replace README with README.xml
+
+2004-05-22 19:37  dave
+
+	* t/test.t: Added more tests to increase coverage
+
+2003-05-14 21:17  dave
+
+	* t/pod.t, t/test.t: Added support for DateTime.pm (but only is
+	  it's installed).
+	  Updated POD tests.
+
+2003-05-14 21:16  dave
+
+	* lib/Calendar/Simple.pm: Added support for DateTime.pm (but only
+	  is it's installed).
+
+2003-02-19 20:22  dave
+
+	* Changes: Removed from CVS
+
+2003-02-19 20:20  dave
+
+	* t, t/pod.t, t/test.t: New test files
+
+2003-02-19 20:19  dave
+
+	* Makefile.PL: Added Test::More and Test::Pod as prereqs.
+
+2003-02-19 20:19  dave
+
+	* MANIFEST: Removed test.pl
+	  Added t/*
+
+2003-02-19 20:18  dave
+
+	* test.pl: Moved tests to t/*
+
+2003-02-19 20:17  dave
+
+	* lib/Calendar/Simple.pm: Ensure that all week arrays contain
+	  seven elements - previously the
+	  last one ended on the last day of the month.
+
+2002-07-30 21:46  dave
+
+	* Changes, lib/Calendar/Simple.pm: Fixed the stupid error from the
+	  last fix.
+
+2002-07-30 19:40  dave
+
+	* lib/Calendar/Simple.pm: Fixed undefined value errors
+
+2002-07-13 14:07  dave
+
+	* lib/Calendar/Simple.pm: Doc patches
+
+2002-07-12 18:27  dave
+
+	* COPYING, MANIFEST: Added COPYING
+
+2002-07-12 18:25  dave
+
+	* lib/Calendar/Simple.pm: Added CVS tags
+
+2002-07-12 18:23  dave
+
+	* lib/Calendar/Simple.pm, test.pl: Added start day option
+
+2002-07-12 18:15  dave
+
+	* Calendar-Simple-0.01.tar, Makefile: Unnecessary Checkin
+
+2002-07-12 18:13  dave
+
+	* Calendar-Simple-0.01.tar, Changes, MANIFEST, Makefile,
+	  Makefile.PL, README, lib, lib/Calendar, lib/Calendar/Simple.pm,
+	  test.pl: Initial revision
+
+2002-07-12 18:13  
+
+	* branches, tags, .: New repository initialized by cvs2svn.
+

Added: packages/libcalendar-simple-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/MANIFEST?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/MANIFEST (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/MANIFEST Wed Nov 22 11:44:28 2006
@@ -1,0 +1,15 @@
+Changes
+Makefile.PL
+Build.PL
+MANIFEST
+README
+COPYING
+lib/Calendar/Simple.pm
+t/test.t
+t/pod.t
+t/no_dt.t
+t/pod_coverage.t
+t/date_span.t
+bin/pcal
+META.yml                                 Module meta-data (added by MakeMaker)
+SIGNATURE    Added here by Module::Build

Propchange: packages/libcalendar-simple-perl/branches/upstream/current/MANIFEST
------------------------------------------------------------------------------
    svn:executable = 

Added: packages/libcalendar-simple-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/META.yml?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/META.yml (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/META.yml Wed Nov 22 11:44:28 2006
@@ -1,0 +1,19 @@
+---
+name: Calendar-Simple
+version: 1.17
+author:
+  - Dave Cross <dave at dave.org.uk
+abstract: Perl extension to create simple calendars
+license: perl
+resources:
+  license: http://dev.perl.org/licenses/
+requires:
+  Test::More: 0
+provides:
+  Calendar::Simple:
+    file: lib/Calendar/Simple.pm
+    version: 1.17
+generated_by: Module::Build version 0.2805
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.2.html
+  version: 1.2

Added: packages/libcalendar-simple-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/Makefile.PL?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/Makefile.PL (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/Makefile.PL Wed Nov 22 11:44:28 2006
@@ -1,0 +1,16 @@
+# Note: this file was auto-generated by Module::Build::Compat version 0.03
+use ExtUtils::MakeMaker;
+WriteMakefile
+(
+          'PL_FILES' => {},
+          'INSTALLDIRS' => 'site',
+          'NAME' => 'Calendar::Simple',
+          'EXE_FILES' => [
+                           'bin/pcal'
+                         ],
+          'VERSION_FROM' => 'lib/Calendar/Simple.pm',
+          'PREREQ_PM' => {
+                           'Test::More' => 0
+                         }
+        )
+;

Added: packages/libcalendar-simple-perl/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/README?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/README (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/README Wed Nov 22 11:44:28 2006
@@ -1,0 +1,33 @@
+
+Calendar::Simple
+----------------
+
+NAME
+
+  Calendar::Simple
+
+DESCRIPTION
+
+  This is a very simple module that models a calendar month.
+
+INSTALLATION
+
+  To install this module type the following:
+
+       perl Makefile.PL
+       make
+       make test
+       make install
+
+
+DEPENDENCIES
+
+  This module has no external dependencies.
+
+COPYRIGHT AND LICENCE
+
+  This script is free software; you can redistribute it and/or modify it
+  under the same terms as Perl itself.
+
+  Copyright (C) 2002 Dave Cross, All rights reserved.
+

Added: packages/libcalendar-simple-perl/branches/upstream/current/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/SIGNATURE?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/SIGNATURE (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/SIGNATURE Wed Nov 22 11:44:28 2006
@@ -1,0 +1,37 @@
+This file contains message digests of all files listed in MANIFEST,
+signed via the Module::Signature module, version 0.55.
+
+To verify the content in this distribution, first make sure you have
+Module::Signature installed, then type:
+
+    % cpansign -v
+
+It will check each file's integrity, as well as the signature's
+validity.  If "==> Signature verified OK! <==" is not displayed,
+the distribution may already have been compromised, and you should
+not run its Makefile.PL or Build.PL.
+
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
+SHA1 fb6f00625da3d095d7f472f2df36472246cc09dd Build.PL
+SHA1 7834569ee0baaefd28e5fd5114a52b6979d99f4d COPYING
+SHA1 5e33adb8b5d3b29035933dd270472bdfc21941a4 Changes
+SHA1 9169c821c4fcc79145aada7db19e7d338633c46c MANIFEST
+SHA1 93b4fa97c385489648b0cb5d6a2f87afe9bd2ee0 META.yml
+SHA1 b87531062e37d28e67b2c1c54a95b24562d425f4 Makefile.PL
+SHA1 f468a58e1b445d4ff9c8f7a6abfadfee2dc8e927 README
+SHA1 2fc32b2fff88c61137dcbf3eea02819738918b8b bin/pcal
+SHA1 6bed100845fd69eb0db44ff384bd057602f96354 lib/Calendar/Simple.pm
+SHA1 9d015a8aebc858d94f5721fc9fad66ac25ea940d t/date_span.t
+SHA1 879d86c37895757c937e2aff6b9d57ded967dc75 t/no_dt.t
+SHA1 e9c6a5881fc60173fbc8d479c1afd2ce3b43bef1 t/pod.t
+SHA1 de1b8a6f043bb49463103b0fc02a65276f790a68 t/pod_coverage.t
+SHA1 fd8a8e826e923cd76701f927193a915a71cdfb58 t/test.t
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.5 (GNU/Linux)
+
+iD8DBQFFM+DfhlYrNpFq+8ERAoGpAKCa1ZF9M7noK31q+xzwMyVY/IEojwCcD9pn
+j+zzg60mq/SFnRLlLKVvdW8=
+=TOif
+-----END PGP SIGNATURE-----

Added: packages/libcalendar-simple-perl/branches/upstream/current/bin/pcal
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/bin/pcal?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/bin/pcal (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/bin/pcal Wed Nov 22 11:44:28 2006
@@ -1,0 +1,22 @@
+#!/usr/bin/perl -w
+ 
+use strict;
+use Calendar::Simple;
+ 
+my @months = qw(January February March April May June July August
+                September October November December);
+ 
+my $mon = shift || (localtime)[4] + 1;
+my $yr  = shift || (localtime)[5] + 1900;
+ 
+my @month = calendar($mon, $yr);
+
+my $mon_name = $months[$mon - 1];
+my $pad = int((20 - length("$mon_name $yr")) / 2);
+ 
+print "\n", ' ' x $pad, "$months[$mon - 1] $yr\n";
+print "Su Mo Tu We Th Fr Sa\n";
+foreach (@month) {
+  print map { $_ ? sprintf "%2d ", $_ : '   ' } @$_;
+  print "\n";
+}

Propchange: packages/libcalendar-simple-perl/branches/upstream/current/bin/pcal
------------------------------------------------------------------------------
    svn:executable = 

Added: packages/libcalendar-simple-perl/branches/upstream/current/lib/Calendar/Simple.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/lib/Calendar/Simple.pm?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/lib/Calendar/Simple.pm (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/lib/Calendar/Simple.pm Wed Nov 22 11:44:28 2006
@@ -1,0 +1,266 @@
+# $Id: Simple.pm 39 2006-10-16 19:41:18Z dave $
+
+=head1 NAME
+
+Calendar::Simple - Perl extension to create simple calendars
+
+=head1 SYNOPSIS
+
+  use Calendar::Simple;
+
+  my @curr      = calendar;             # get current month
+  my @this_sept = calendar(9);          # get 9th month of current year
+  my @sept_2002 = calendar(9, 2002);    # get 9th month of 2002
+  my @monday    = calendar(9, 2002, 1); # get 9th month of 2002,
+                                        # weeks start on Monday
+
+  my @span      = date_span(mon   => 10,  # returns span of dates
+                            year  => 2006,
+                            begin => 15,
+                            end   => 28);
+
+=cut
+
+package Calendar::Simple;
+
+use strict;
+use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
+
+require Exporter;
+
+ at ISA = qw(Exporter);
+
+ at EXPORT = qw(calendar);
+ at EXPORT_OK = qw(date_span);
+$VERSION = '1.17';
+
+use Time::Local;
+use Carp;
+
+eval 'use DateTime';
+my $dt = ! $@;
+$dt = 0 if $ENV{CAL_SIMPLE_NO_DT};
+
+my @days = qw(31 xx 31 30 31 30 31 31 30 31 30 31);
+
+=head1 DESCRIPTION
+
+A very simple module that exports one function called C<calendar>.
+
+=head2 calendar
+
+This function returns a data structure representing the dates in a month.
+The data structure returned is an array of array references. The first
+level array represents the weeks in the month. The second level array
+contains the actual days. By default, each week starts on a Sunday and
+the value in the array is the date of that day. Any days at the beginning
+of the first week or the end of the last week that are from the previous or
+next month have the value C<undef>.
+
+If the month or year parameters are omitted then the current month or
+year are assumed.
+
+A third, optional parameter, start_day, allows you to set the day each
+week starts with, with the same values as localtime sets for wday
+(namely, 0 for Sunday, 1 for Monday and so on).
+
+=cut
+
+sub calendar {
+  my ($mon, $year, $start_day) = @_;
+
+  my @now = (localtime)[4, 5];
+
+  $mon = ($now[0] + 1) unless $mon;
+  $year = ($now[1] + 1900) unless $year;
+  $start_day = 0 unless defined $start_day;
+
+  croak "Year $year out of range" if $year < 1970 && !$dt;
+  croak "Month $mon out of range" if ($mon  < 1 || $mon > 12);
+  croak "Start day $start_day out of range"
+    if ($start_day < 0 || $start_day > 6);
+
+  my $first;
+
+  if ($dt) {
+    $first = DateTime->new(year => $year,
+			   month => $mon,
+			   day => 1)->day_of_week % 7;
+  } else {
+    $first = (localtime timelocal 0, 0, 0, 1, $mon -1, $year - 1900)[6];
+  }
+
+  $first -= $start_day;
+  $first += 7 if ($first < 0);
+
+  my @mon = (1 .. _days($mon, $year));
+
+  my @first_wk = (undef) x 7;
+  @first_wk[$first .. 6] = splice @mon, 0, 6 - $first + 1;
+
+  my @month = (\@first_wk);
+
+  while (my @wk = splice @mon, 0, 7) {
+    push @month, \@wk;
+  }
+
+  $#{$month[-1]} = 6;
+
+  return wantarray ? @month : \@month;
+}
+
+=head2 date_span
+
+This function returns a cur-down version of a month data structure which
+begins and ends on dates other than the first and last dates of the month.
+Any weeks that fall completely outside of the date range are removed from
+the structure and any days within the remaining weeks that fall outside
+of the date range are set to C<undef>.
+
+As there are a number of parameters to this function, they are passed
+using a named parameter interface. The parameters are as follows:
+
+=over 4
+
+=item year
+
+The required year. Defaults to the current year if omitted.
+
+=item mon
+
+The required month. Defaults to the current month if omitted.
+
+=item begin
+
+The first day of the required span. Defaults to the first if omitted.
+
+=item end
+
+The last day of the required span. Defaults to the last day of the month
+if omitted.
+
+=item start_day
+
+Indicates the day of the week that each week starts with. This takes the same
+values as the optional third parameter to C<calendar>. The default is 0
+(for Sunday).
+
+=back
+
+This function isn't exported by default, so in order to use it in your
+program you need to use the module like this:
+
+  use Calendar::Simple 'date_span';
+
+=cut
+
+sub date_span {
+  my %params = @_;
+
+  my @now = (localtime)[4, 5];
+
+  my $mon   = $params{mon}   || ($now[0] + 1);
+  my $year  = $params{year}  || ($now[1] + 1900);
+  my $begin = $params{begin} || 1;
+  my $end    = $params{end}   || _days($mon, $year);
+  my $start_day = defined $params{start_day} ? $params{start_day} : 0;
+
+  my @cal = calendar($mon, $year, $start_day);
+
+  while ($cal[0][6] < $begin) {
+    shift @cal;
+  }
+
+  my $i = 0;
+  while ($cal[0][$i] < $begin) {
+    $cal[0][$i++] = undef;
+  }
+
+  while ($cal[-1][0] > $end) {
+    pop @cal;
+  }
+
+  $i = -1;
+  while ($cal[-1][$i] > $end) {
+    $cal[-1][$i--] = undef;
+  }
+
+  return @cal;
+}
+
+sub _days {
+  my ($mon, $yr) = @_;
+
+  return $days[$mon - 1] unless $mon == 2;
+  return _isleap($yr) ? 29 : 28;
+}
+
+sub _isleap {
+  return 1 unless $_[0] % 400;
+  return   unless $_[0] % 100;
+  return 1 unless $_[0] % 4;
+  return;
+}
+
+1;
+__END__
+
+=head2 EXAMPLE
+
+A simple C<cal> replacement would therefore look like this:
+
+  #!/usr/bin/perl -w
+
+  use strict;
+  use Calendar::Simple;
+
+  my @months = qw(January February March April May June July August
+                  September October November December);
+
+  my $mon = shift || (localtime)[4] + 1;
+  my $yr  = shift || (localtime)[5] + 1900;
+
+  my @month = calendar($mon, $yr);
+
+  print "\n$months[$mon -1] $yr\n\n";
+  print "Su Mo Tu We Th Fr Sa\n";
+  foreach (@month) {
+    print map { $_ ? sprintf "%2d ", $_ : '   ' } @$_;
+    print "\n";
+  }
+
+A version of this example, called C<pcal>, is installed when you install this
+module.
+
+=head2 Date Range
+
+This module will make use of DateTime.pm if it is installed. By using
+DateTime.pm it can use any date that DateTime can represent. If DateTime
+is not installed it uses Perl's built-in date handling and therefore
+can't deal with dates before 1970 and it will also have problems with dates
+after 2038 on a 32-bit machine.
+
+=head2 EXPORT
+
+C<calendar>
+
+=head1 AUTHOR
+
+Dave Cross <dave at mag-sol.com>
+
+=head1 ACKNOWLEDGEMENTS
+
+With thanks to Paul Mison <cpan at husk.org> for the start day patch.
+
+=head1 COPYRIGHT
+
+Copyright (C) 2002-2006, Magnum Solutions Ltd..  All Rights Reserved.
+
+This script is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<perl>, L<localtime>, L<DateTime>
+
+=cut

Propchange: packages/libcalendar-simple-perl/branches/upstream/current/lib/Calendar/Simple.pm
------------------------------------------------------------------------------
    svn:executable = 

Added: packages/libcalendar-simple-perl/branches/upstream/current/t/date_span.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/t/date_span.t?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/t/date_span.t (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/t/date_span.t Wed Nov 22 11:44:28 2006
@@ -1,0 +1,30 @@
+use Test::More tests => 14;
+use_ok('Calendar::Simple', 'date_span');
+
+my @span = date_span(year  => 2006,
+		     mon   => 10,
+		     begin => 15,
+		     end   => 28);
+
+is(@span, 2);
+is($span[0][0], 15);
+is($span[1][6], 28);
+
+ at span = date_span(year => 2006,
+                  mon  => 10,
+                  begin => 17,
+                  end   => 24);
+is(@span, 2);
+ok(!defined $span[0][0]);
+is($span[0][2], 17);
+ok(!defined $span[1][6]);
+is($span[1][2], 24);
+
+ at span = date_span(year => 2006,
+                  mon  => 10);
+
+is(@span, 5);
+is(defined $span[0][0], 1);
+is($span[2][2], 17);
+ok(!defined $span[-1][6]);
+is($span[-1][2], 31);

Added: packages/libcalendar-simple-perl/branches/upstream/current/t/no_dt.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/t/no_dt.t?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/t/no_dt.t (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/t/no_dt.t Wed Nov 22 11:44:28 2006
@@ -1,0 +1,65 @@
+use Test::More tests => 33;
+$ENV{CAL_SIMPLE_NO_DT} = 1;
+use_ok('Calendar::Simple');
+
+my @month = calendar(9, 2002);
+
+is(@month, 5);
+is(@{$month[0]}, 7);
+is($month[0][0], 1);
+ok(not defined $month[-1][-1]);
+is($#{$month[-1]}, 6);
+
+ at month = calendar(2, 2009);
+is(@month, 4);
+is($month[0][0], 1);
+is($month[3][6], 28);
+ok(defined $month[-1][-1]);
+is($#{$month[-1]}, 6);
+
+ at month = calendar(1, 2002);
+ok(not defined $month[0][0]);
+is($month[0][2], 1);
+is($month[4][4], 31);
+ok(not defined $month[4][6]);
+ok(not defined $month[-1][-1]);
+is($#{$month[-1]}, 6);
+
+ at month = calendar(1, 2002, 1);
+ok(not defined $month[0][0]);
+is($month[0][1], 1);
+is($month[4][3], 31);
+ok(not defined $month[4][4]);
+ok(not defined $month[-1][-1]);
+is($#{$month[-1]}, 6);
+
+ at month = calendar();
+ok(@month);
+
+eval { @month = calendar(-1) };
+ok($@);
+
+eval { @month = calendar(13) };
+ok($@);
+
+eval { @month = calendar(1, 2000, -1) };
+ok($@);
+
+eval { @month = calendar(1, 2000, 7) };
+ok($@);
+
+ at month = calendar(2, 2000);
+ok(@month);
+
+eval { @month = calendar(2, 2100) };
+ok($@);
+
+eval { @month = calendar(2, 1500) };
+ok($@);
+
+ at month = calendar(2, 2004);
+ok(@month);
+
+my $month = calendar();
+is(ref $month, 'ARRAY');
+

Propchange: packages/libcalendar-simple-perl/branches/upstream/current/t/no_dt.t
------------------------------------------------------------------------------
    svn:executable = 

Added: packages/libcalendar-simple-perl/branches/upstream/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/t/pod.t?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/t/pod.t (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/t/pod.t Wed Nov 22 11:44:28 2006
@@ -1,0 +1,4 @@
+use Test::More;
+eval "use Test::Pod 1.00";
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+all_pod_files_ok();

Propchange: packages/libcalendar-simple-perl/branches/upstream/current/t/pod.t
------------------------------------------------------------------------------
    svn:executable = 

Added: packages/libcalendar-simple-perl/branches/upstream/current/t/pod_coverage.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/t/pod_coverage.t?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/t/pod_coverage.t (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/t/pod_coverage.t Wed Nov 22 11:44:28 2006
@@ -1,0 +1,4 @@
+use Test::More;
+eval "use Test::Pod::Coverage 1.00";
+plan skip_all => "Test::Pod::Coverage 1.00 required for testing POD coverage" if $@;
+all_pod_coverage_ok();

Added: packages/libcalendar-simple-perl/branches/upstream/current/t/test.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libcalendar-simple-perl/branches/upstream/current/t/test.t?rev=4332&op=file
==============================================================================
--- packages/libcalendar-simple-perl/branches/upstream/current/t/test.t (added)
+++ packages/libcalendar-simple-perl/branches/upstream/current/t/test.t Wed Nov 22 11:44:28 2006
@@ -1,0 +1,70 @@
+use Test::More tests => 34;
+use_ok('Calendar::Simple');
+
+my @month = calendar(9, 2002);
+
+is(@month, 5);
+is(@{$month[0]}, 7);
+is($month[0][0], 1);
+ok(not defined $month[-1][-1]);
+is($#{$month[-1]}, 6);
+
+ at month = calendar(2, 2009);
+is(@month, 4);
+is($month[0][0], 1);
+is($month[3][6], 28);
+ok(defined $month[-1][-1]);
+is($#{$month[-1]}, 6);
+
+ at month = calendar(1, 2002);
+ok(not defined $month[0][0]);
+is($month[0][2], 1);
+is($month[4][4], 31);
+ok(not defined $month[4][6]);
+ok(not defined $month[-1][-1]);
+is($#{$month[-1]}, 6);
+
+ at month = calendar(1, 2002, 1);
+ok(not defined $month[0][0]);
+is($month[0][1], 1);
+is($month[4][3], 31);
+ok(not defined $month[4][4]);
+ok(not defined $month[-1][-1]);
+is($#{$month[-1]}, 6);
+
+ at month = calendar(2, 2004, 3);
+ok(@month);
+
+ at month = calendar();
+ok(@month);
+
+eval { @month = calendar(-1) };
+ok($@);
+
+eval { @month = calendar(13) };
+ok($@);
+
+eval { @month = calendar(1, 2000, -1) };
+ok($@);
+
+eval { @month = calendar(1, 2000, 7) };
+ok($@);
+
+ at month = calendar(2, 2000);
+ok(@month);
+
+ at month = calendar(2, 2004);
+ok(@month);
+
+my $month = calendar();
+is(ref $month, 'ARRAY');
+
+SKIP: {
+  eval { require DateTime };
+  skip "DateTime not installed", 2, if $@ || $ENV{CAL_SIMPLE_NO_DT};
+  @month = calendar(1,1500);
+  ok(@month);
+
+  @month = calendar(2, 2100);
+  ok(@month);
+}

Propchange: packages/libcalendar-simple-perl/branches/upstream/current/t/test.t
------------------------------------------------------------------------------
    svn:executable = 




More information about the Pkg-perl-cvs-commits mailing list