I have been working my way through the examples in Test::Tutorial and the very first example does not work as expected. At first I thought I was doing something wrong. (hey, maybe I am!) But as far as I can tell, there's no way these inputs should give these outputs. Check out the following code:

#!/usr/bin/perl -w use strict; use Test::More tests => 8; use Date::ICal; my $ical = Date::ICal->new( year => 1964, month => 10, day => 6, hour => 6, min => 12, sec => 47, tz => '0530' ); ok( defined $ical, 'new() returned something' ); ok( $ical->isa('Date::ICal'), " and it's the right class" ); is( $ical->sec , 47, ' sec()' ); is( $ical->min , 12, ' min()' ); is( $ical->hour , 16, ' hour()' ); is( $ical->day , 16, ' day()' ); is( $ical->month , 10, ' month()' ); is( $ical->year , 1964, ' year()' );

Running this code with a debugging 'perl testmore.pl' gives the following output:
[jens@dhcp32 jens]$ perl testmore.pl 1..8 ok 1 - new() returned something ok 2 - and it's the right class ok 3 - sec() ok 4 - min() not ok 5 - hour() # Failed test (testmore.pl at line 20) # got: '20' # expected: '16' not ok 6 - day() # Failed test (testmore.pl at line 21) # got: '5' # expected: '16' ok 7 - month() ok 8 - year() # Looks like you failed 2 tests of 8.
How is Test::More coming up with these values? (or is it correctly indicating a bug in Date::Ical?)

Note: if you examine this example in Test::Tutorial, you'll notice I've changed values of hour and day from 16 for both to 6. My first original test--cut and pasted out of Test::Tutorial--gave me an error on hour:
not ok 5 - hour() # Failed test (testmore.pl at line 20) # got: '6' # expected: '16'
Can anyone else verify this bug? Obviously this is a bug in the docco Test::Tutorial. But is it a bug in Test::More or in Date::Ical? (or have I done something weird?)

In reply to Test::More bug? by jens

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.