Subject: | make test reports failure in filetypes.t - bug in tests |
Date: | Fri, 22 Dec 2006 10:15:51 +0100 |
To: | bug-ack [...] rt.cpan.org |
From: | "Torsten Blix" <torsten.blix [...] gmx.de> |
Hi,
this occurs for App::Ack, Version 1.52 on perl, v5.6.1 built for i386-linux
make test reports two failures in filetypes.t:
t/filetypes.........NOK 24
# Failed test 'file identified as html '
# at t/filetypes.t line 73.
# Structures begin differing at:
# $got->[0] = 'html'
# $expected->[0] = 'php'
t/filetypes.........NOK 25
# Failed test 'file identified as htm[l]'
# at t/filetypes.t line 76.
# Structures begin differing at:
# $got->[0] = 'html'
# $expected->[0] = 'php'
# Looks like you failed 2 tests of 25.
t/filetypes.........dubious
These occur because the filetypes returned by App::Ack::filetypes are not in a defined order (filled by iterating over a hash and pushing onto a list). What is necessary for the test is to sort the list returned by App::Ack::filetypes before comparing. The following patch to filetypes.t does that.
Cheers,
Torsten
Show quoted text
> ~/.cpan/build/ack-1.52/t$ diff -u filetypes.t.old filetypes.t
--- filetypes.t.old Wed Dec 20 08:23:48 2006
+++ filetypes.t Fri Dec 22 09:53:02 2006
@@ -70,10 +70,12 @@
## .htm[l]? is identified as qw(php html)
## Are there really servers with .html extension instead of .php ?
## <!DOCTYPE html ...>\n\n<?php...> would require more than one line lookahead.
-is_deeply([App::Ack::filetypes('t/swamp/html.html')], [qw/php html/],
+my @foo_html_types = App::Ack::filetypes( 't/swamp/html.html' );
+is_deeply([sort @foo_html_types], [qw/html php/],
'file identified as html ');
-is_deeply([App::Ack::filetypes('t/swamp/html.htm')], [qw/php html/],
+my @foo_htm_types = App::Ack::filetypes( 't/swamp/html.htm' );
+is_deeply([sort @foo_htm_types], [qw/html php/],
'file identified as htm[l]');
--
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer