Commits

Toby Inkster committed 7684eba

Final test commit before release

Comments (0)

Files changed (3)

 		dcs:item   [ rdfs:label "'querySelector' and 'querySelectorAll' methods."@en ; a dcs:Addition ] ;
 		dcs:item   [ rdfs:label "Web::Magic::Async"@en ; a dcs:Addition ] ;
 		dcs:item   [ rdfs:label "Throw blessed objects as exceptions."@en ] ;
-		dcs:item   [ rdfs:label "Improved documentation - especially of exceptions"@en ; a dcs:Documentation ] ;
+		dcs:item   [ rdfs:label "Improved documentation - especially of exceptions."@en ; a dcs:Documentation ] ;
+		dcs:item   [ rdfs:label "Include a fairly extensive test suite."@en ; a dcs:Packaging ] ;
 		dcs:item   [ rdfs:label "Escape URIs properly."@en ; a dcs:Bugfix ]
 		] .
 
 is($weird->querySelector('br > b')->toString, '<b>example</b>', 'querySelector works for XML');
 
 my $not_found = W( baseuri('not_found') );
-is($not_found->querySelector('title')->toString, '<title>404</title>', '404 pages can be HTML too');
+like(
+	$not_found->querySelector('title')->toString, 
+	qr{^  <title.*>404</title>  $}x,
+	'404 pages can be HTML too',
+	);
 
 local $@ = undef;
 eval { W( baseuri('ex_json') )->to_dom };
 my $exception = $@;
 
 isa_ok $exception, 'Web::Magic::Exception::BadReponseType',
-	"attempting to parse JSON as a DOM throws exception which";
+	"attempting to parse JSON as a DOM throws exception which";

t/lib/TestHttpServer.pm

 our $server  = Test::HTTP::Server->new();
 our $baseuri = $::server->uri;
 sub baseuri { join '', $baseuri, @_; }
-diag baseuri();
+#diag baseuri();
 
 sub Test::HTTP::Server::Request::ex_json {$_[0]->{out_headers}{content_type}='application/json' and <<'DATA'}
 {
 }
 DATA
 
+sub Test::HTTP::Server::Request::ex_slow
+{
+	my $self = shift;
+	Test::More::diag "sleeping";
+	#sleep 2;
+	Test::More::diag "waking";
+	Test::More::ok($::DELAY, 'DELAY');
+	$self->{out_headers}{content_type}='text/plain';
+	return <<'DATA'
+Hello world!
+DATA
+}
+
 sub Test::HTTP::Server::Request::ex_json_array {$_[0]->{out_headers}{content_type}='application/x-array+json' and <<'DATA'}
 [
 	{