1use Apache::ASP::CGI::Test; 2 3use lib qw(t . ..); 4use T; 5use strict; 6 7my $t = T->new; 8my $r = Apache::ASP::CGI::Test->do_self( 9 UseStrict => 1, 10 CookieDomain => 'apache-asp.com', 11 SecureSession => 1, 12 CookiePath => '/eg/' 13 ); 14my $header = $r->test_header_out; 15my $body = $r->test_body_out; 16 17my @cookie_tests = ( 18 'Set-Cookie: test=cookie; path=/', 19 'Set-Cookie: test2=value; expires=Wed, 06 Nov 2002 21:52:30 GMT; path=/path/; domain=test.com; secure', 20 'Set-Cookie: test3=key1=value1&key2=value2; path=/', 21 'Set-Cookie: session-id=[0-9a-f]+; path=/eg/; domain=apache-asp.com; secure', 22 ); 23 24for my $cookie_test ( @cookie_tests ) { 25# $cookie_test =~ s/(\W)/$1/isg; 26 $t->eok(($header =~ /$cookie_test/s) ? 1 : 0, "Cookies header test"); 27} 28 29$t->eok($body =~ /^\s*1\.\.1\nok\s*$/ ? 1 : 0, "Body test"); 30$t->done; 31 32__END__ 33<% 34$Response->{Cookies}{test} = "cookie"; 35$Response->{Cookies}{test2} = { 36 Value => 'value', 37 Path => "/path/", 38 Secure => 1, 39 Expires => "Wed, 06 Nov 2002 21:52:30 GMT", 40 Domain => 'test.com', 41 }; 42$Response->Cookies("test3", "key1", "value1"); 43$Response->Cookies("test3", "key2", "value2"); 44$t->ok; 45%> 46 47