Skip Menu |

This queue is for tickets about the iCal-Parser-HTML CPAN distribution.

Report information
The Basics
Id: 94968
Status: new
Priority: 0/
Queue: iCal-Parser-HTML

People
Owner: Nobody in particular
Requestors: fschlich [...] zedat.fu-berlin.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.07
Fixed in: (no value)



Subject: test failures in t/01parse.t
Hi, t/01parse.t fails due to a number of problems, partly addressed by the attached patches: 1) the sidebar is rendered with only one week per month, as $next-week is compared to $month instead of $this-month (this-month.patch) 2) the HTML generated on my system is indented, whereas the data files are not; also, there are whitespace and case differences for the charset definition (normalize-test-output.patch) 3) from Perl 5.18, hashes are actually random in order, so much so that "keys %testmap" will yield a different order on every invocation. hash-randomization.patch attempts to pin the order used to produce the data files, but a better solution would be to use 'sort keys %testmap' 4) on failure, the tests output a lot of text, most of which doesn't differ from what's expected. Test::LongString can be a useful tool here (cf test-longstring.patch, but it could probably show more context, especially after the first difference) These patches do not solve the following two issues: a) the data files used to compare against contain wrong week numbers, e.g. 1. January 2004 is week 1 (not 52 as in complex.ics.year.html), and 1 November 2004 is week 45 (not 44 as in complex.ics.month.html). See http://en.wikipedia.org/wiki/ISO_week and http://www.personal.ecu.edu/mccartyr/isowdcal.html to verify. b) there is yet another hash randomization / ordering issue in the multical tests, where the order of events from two different calendars but with the same start time varies (sometimes calendar-1 ist first, sometimes the event with class calendar-2). I'm not even sure a variable ordering is to be considered a bug, but it's certainly not good to test against. Florian
Subject: hash-randomization.patch
Description: fix hash randomization issues a better solution would be to say 'sort keys %testmap', but that's not the order in use in $expected Author: Florian Schlichting <fsfs@debian.org> Forwarded: not-yet --- a/t/01parse.t +++ b/t/01parse.t @@ -30,7 +30,7 @@ foreach my $type ( qw(day week month year) ) { my $got=$parser ->parse(type=>$type,start=>'2004-11-12',url=>'multical?', - files=>[map {"t/calendars/$_"} keys %testmap]); + files=>['t/calendars/event-duration.ics', 't/calendars/complex.ics', 't/calendars/all-day-event.ics']); $got=~s/today//g; $got=~s/ class=""//g; dump_html("$caldir/multical.$type.html",$got) if $ENV{_DUMP_TEST_HTML_}; @@ -44,7 +44,7 @@ foreach my $type ( qw(day week month) ) { my $got=$parser ->parse(type=>$type,start=>'2004-11-12', - files=>[map {"t/calendars/$_"} keys %testmap]); + files=>['t/calendars/event-duration.ics', 't/calendars/complex.ics', 't/calendars/all-day-event.ics']); $got=~s/today//g; $got=~s/ class=""//g; dump_html("$caldir/multical.nolink.$type.html",$got) if $ENV{_DUMP_TEST_HTML_};
Subject: normlize-test-output.patch
Description: fix test failure due to output formatting differences Author: Florian Schlichting <fsfs@debian.org> Forwarded: not_yet --- a/t/01parse.t +++ b/t/01parse.t @@ -20,6 +20,9 @@ $got=~s/ class=""//g; dump_html("$caldir/$f.$type.html",$got) if $ENV{_DUMP_TEST_HTML_}; my $expect=slurp("$caldir/$f.$type.html"); + $got =~ s/^ *//gm; # $got is indented + $expect =~ s/^ *//gm; # $expect is not intendet but once + $expect =~ s/; charset=utf-8/; charset=UTF-8/; is($got,$expect,"$f -> $type"); } } @@ -32,6 +35,9 @@ $got=~s/ class=""//g; dump_html("$caldir/multical.$type.html",$got) if $ENV{_DUMP_TEST_HTML_}; my $expect=slurp("t/calendars/multical.$type.html"); + $got =~ s/^ *//gm; # $got is indented + $expect =~ s/^ *//gm; # $expect is not intendet but once + $expect =~ s/; charset=utf-8/; charset=UTF-8/; is($got,$expect,"multical -> $type"); } #no link output @@ -43,6 +49,9 @@ $got=~s/ class=""//g; dump_html("$caldir/multical.nolink.$type.html",$got) if $ENV{_DUMP_TEST_HTML_}; my $expect=slurp("t/calendars/multical.nolink.$type.html"); + $got =~ s/^ *//gm; # $got is indented + $expect =~ s/^ *//gm; # $expect is not intendet but once + $expect =~ s/; charset=utf-8/; charset=UTF-8/; is($got,$expect,"multical -> $type (no links)"); } sub dump_html {
Subject: test-longstring.patch
Description: use Test::LongString for more readable failure output Author: Florian Schlichting <fsfs@debian.org> Forwarded: not-yet --- a/t/01parse.t +++ b/t/01parse.t @@ -1,5 +1,6 @@ # -*- cperl -*- use Test::More; +use Test::LongString; use iCal::Parser::HTML; my $parser=iCal::Parser::HTML->new; @@ -23,7 +24,7 @@ $got =~ s/^ *//gm; # $got is indented $expect =~ s/^ *//gm; # $expect is not intendet but once $expect =~ s/; charset=utf-8/; charset=UTF-8/; - is($got,$expect,"$f -> $type"); + is_string($got,$expect,"$f -> $type"); } } #multiple calendar input @@ -38,7 +39,7 @@ $got =~ s/^ *//gm; # $got is indented $expect =~ s/^ *//gm; # $expect is not intendet but once $expect =~ s/; charset=utf-8/; charset=UTF-8/; - is($got,$expect,"multical -> $type"); + is_string($got,$expect,"multical -> $type"); } #no link output foreach my $type ( qw(day week month) ) { @@ -52,7 +53,7 @@ $got =~ s/^ *//gm; # $got is indented $expect =~ s/^ *//gm; # $expect is not intendet but once $expect =~ s/; charset=utf-8/; charset=UTF-8/; - is($got,$expect,"multical -> $type (no links)"); + is_string($got,$expect,"multical -> $type (no links)"); } sub dump_html { my($expect,$got)=@_;
Subject: this-month.patch
Description: fix rendering of previous and following month in sidebar Otherwise, only the first week of the month would be rendered as $month is the current month (11 for the complex.ics tests) Author: Florian Schlichting <fsfs@debian.org> Forwarded: not yet --- a/lib/iCal/Parser/HTML/stylesheet/month-util.xsl +++ b/lib/iCal/Parser/HTML/stylesheet/month-util.xsl @@ -86,7 +86,7 @@ </xsl:call-template> </tr> <xsl:variable name="next-week" select="date:add($start-date,'P7D')"/> - <xsl:if test="date:month-in-year($next-week) = $month"> + <xsl:if test="date:month-in-year($next-week) = $this-month"> <xsl:call-template name="week"> <xsl:with-param name="start-date" select="$next-week"/> <xsl:with-param name="month" select="$month"/>