From: t0m Date: Fri, 12 Dec 2008 11:52:55 +0000 (+0000) Subject: Add tests showing how retarded my implementation is. Also remove Makefile from revisi... X-Git-Tag: 1.001~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c2ec1d6a318bf6b95f7e1aaffcc22d3482319976;p=catagits%2FCatalyst-View-ContentNegotiation-XHTML.git Add tests showing how retarded my implementation is. Also remove Makefile from revision control. Fail-whale. --- diff --git a/Changes b/Changes index 671edc8..ccb2c99 100644 --- a/Changes +++ b/Changes @@ -1,4 +1,6 @@ + - Add tests for other Accept header cases where the current code + will get it wrong (David Dorward) 1.000 - First working version of the module extracted from the quick hack I have in every Catalyst application I've ever written. - \ No newline at end of file + diff --git a/Makefile b/Makefile index 1ec3cdf..6e9fde2 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,8 @@ # NAME => q[Catalyst::View::TT::XHTML] # NO_META => q[1] # PL_FILES => { } -# PREREQ_PM => { Catalyst::View::TT=>q[0], ok=>q[0], Test::More=>q[0], ExtUtils::MakeMaker=>q[6.42], Catalyst::Runtime=>q[0], Test::WWW::Mechanize::Catalyst=>q[0], Catalyst::Action::RenderView=>q[0] } -# VERSION => q[0.001000] -# clean => { FILES=>q[META.yml] } +# PREREQ_PM => { Catalyst::View::TT=>q[0], Test::More=>q[0], ExtUtils::MakeMaker=>q[6.42], Catalyst::Runtime=>q[0], Test::WWW::Mechanize::Catalyst=>q[0], Catalyst::Action::RenderView=>q[0] } +# VERSION => q[1.000] # dist => { PREOP=>q[$(PERL) -I. "-MModule::Install::Admin" -e "dist_preop(q($(DISTVNAME)))"] } # --- MakeMaker post_initialize section: @@ -60,11 +59,11 @@ DIRFILESEP = / DFSEP = $(DIRFILESEP) NAME = Catalyst::View::TT::XHTML NAME_SYM = Catalyst_View_TT_XHTML -VERSION = 0.001000 +VERSION = 1.000 VERSION_MACRO = VERSION -VERSION_SYM = 0_001000 +VERSION_SYM = 1_000 DEFINE_VERSION = -D$(VERSION_MACRO)=\"$(VERSION)\" -XS_VERSION = 0.001000 +XS_VERSION = 1.000 XS_VERSION_MACRO = XS_VERSION XS_DEFINE_VERSION = -D$(XS_VERSION_MACRO)=\"$(XS_VERSION)\" INST_ARCHLIB = blib/arch @@ -255,7 +254,7 @@ RCS_LABEL = rcs -Nv$(VERSION_SYM): -q DIST_CP = best DIST_DEFAULT = tardist DISTNAME = Catalyst-View-TT-XHTML -DISTVNAME = Catalyst-View-TT-XHTML-0.001000 +DISTVNAME = Catalyst-View-TT-XHTML-1.000 # --- MakeMaker macro section: @@ -453,7 +452,7 @@ clean :: clean_subdirs perl.exe so_locations \ $(BASEEXT).exp - $(RM_RF) \ - META.yml blib + blib - $(MV) $(FIRST_MAKEFILE) $(MAKEFILE_OLD) $(DEV_NULL) @@ -763,7 +762,7 @@ testdb_static :: testdb_dynamic # --- MakeMaker ppd section: # Creates a PPD (Perl Package Description) for a binary distribution. ppd : - $(NOECHO) $(ECHO) '' > $(DISTNAME).ppd + $(NOECHO) $(ECHO) '' > $(DISTNAME).ppd $(NOECHO) $(ECHO) ' $(DISTNAME)' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' A sub-class of the standard TT view which' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' Tomas Doran C<< <bobtfish@bobtfish.net> >>' >> $(DISTNAME).ppd @@ -774,7 +773,6 @@ ppd : $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd - $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd $(NOECHO) $(ECHO) ' ' >> $(DISTNAME).ppd diff --git a/lib/Catalyst/View/TT/XHTML.pm b/lib/Catalyst/View/TT/XHTML.pm index 3f3dd3a..17bf1bf 100644 --- a/lib/Catalyst/View/TT/XHTML.pm +++ b/lib/Catalyst/View/TT/XHTML.pm @@ -71,6 +71,14 @@ SYNOPSIS). Tomas Doran C<< >> +=head1 CONTRIBUTORS + +=over + +=item David Dorward - test patches + +=back + =head1 COPYRIGHT This module itself is copyright (c) 2008 Tomas Doran and is licensed under the same terms as Perl itself. diff --git a/t/live-test.t b/t/live-test.t index fb058e5..58a8739 100644 --- a/t/live-test.t +++ b/t/live-test.t @@ -2,7 +2,7 @@ use strict; use warnings; -use Test::More tests => 13; +use Test::More tests => 22; # setup library path use FindBin qw($Bin); @@ -42,3 +42,27 @@ $mech->get_ok('http://localhost/nothtml', 'get nothtml page'); $mech->content_like(qr/not html/i, 'see if it has our text'); is $mech->response->headers->{'content-type'}, 'application/json', 'application/json is unmolested'; + +# 14-16 +$mech->add_header( Accept => 'text/html, application/xhtml+xml'); +$mech->get_ok('http://localhost/', 'get main page'); +$mech->content_like(qr/it works/i, 'see if it has our text'); +is $mech->response->headers->{'content-type'}, 'application/xhtml+xml; charset=utf-8', + 'Accept xhtml AND html gives content type application/xhtml+xml'; + + +# 17-19 +$mech->add_header( Accept => 'text/html, application/xhtml+xml;q=0'); +$mech->get_ok('http://localhost/', 'get main page'); +$mech->content_like(qr/it works/i, 'see if it has our text'); +is $mech->response->headers->{'content-type'}, 'text/html; charset=utf-8', + 'Accept header of application/xhtml+xml with q value of 0 and text/html = text/html'; + +# 20-22 +$mech->add_header( Accept => 'text/html;q=0'); +$mech->get_ok('http://localhost/', 'get main page'); +$mech->content_like(qr/it works/i, 'see if it has our text'); +is $mech->response->headers->{'content-type'}, 'application/xhtml+xml; charset=utf-8', + 'Accept html with a q value of 0 gives content type application/xhtml+xml'; + +