You are viewing a plain text version of this content. The canonical link for it is here.
Posted to test-cvs@httpd.apache.org by jw...@apache.org on 2002/02/04 23:05:56 UTC

cvs commit: httpd-test/perl-framework/t/modules negotiation.t

jwoolley    02/02/04 14:05:56

  Modified:    perl-framework/t/modules negotiation.t
  Log:
  Verbose debugging for modules/negotiation.t
  
  Revision  Changes    Path
  1.6       +46 -14    httpd-test/perl-framework/t/modules/negotiation.t
  
  Index: negotiation.t
  ===================================================================
  RCS file: /home/cvs/httpd-test/perl-framework/t/modules/negotiation.t,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -d -u -r1.5 -r1.6
  --- negotiation.t	20 Oct 2001 02:22:59 -0000	1.5
  +++ negotiation.t	4 Feb 2002 22:05:56 -0000	1.6
  @@ -3,6 +3,7 @@
   
   use Apache::Test;
   use Apache::TestRequest;
  +use Apache::TestUtil;
   
   ## mod_negotiation test
   ##
  @@ -55,38 +56,57 @@
       ## verify that the correct default language content is returned
       $actual = GET_BODY "/modules/negotiation/$_/";
       my_chomp();
  -    ok ($actual eq "index.html.$_");
  +    ok t_cmp($actual,
  +             "index.html.$_",
  +             "Verify correct default language for index.$_.foo");
   
       $actual = GET_BODY "/modules/negotiation/$_/compressed/";
       my_chomp();
  -    ok ($actual eq "index.html.$_.gz");
  +    ok t_cmp($actual,
  +             "index.html.$_.gz",
  +             "Verify correct default language for index.$_.foo.gz");
   
       $actual = GET_BODY "/modules/negotiation/$_/two/index";
       my_chomp();
  -    ok ($actual eq "index.$_.html");
  +    ok t_cmp($actual,
  +             "index.$_.html",
  +             "Verify correct default language for index.$_.html");
   
       foreach my $ext (@language) {
   
           ## verify that you can explicitly request all language files.
  -        ok GET_OK "/modules/negotiation/$_/index.html.$ext";
  -        ok GET_OK "/modules/negotiation/$_/two/index.$ext.html";
  +        my $resp = GET("/modules/negotiation/$_/index.html.$ext");
  +        ok t_cmp(200,
  +                 $resp->code,
  +                 "Explicitly request $_/index.html.$ext");
  +        $resp = GET("/modules/negotiation/$_/two/index.$ext.html");
  +        ok t_cmp(200,
  +                 $resp->code,
  +                 "Explicitly request $_/two/index.$ext.html");
   
           ## verify that even tho there is a default language,
           ## the Accept-Language header is obeyed when present.
           $actual = GET_BODY "/modules/negotiation/$_/",
               'Accept-Language' => $ext;
           my_chomp();
  -        ok ($actual eq "index.html.$ext");
  +        ok t_cmp($actual,
  +                 "index.html.$ext",
  +                 "Verify with a default language Accept-Language still obeyed");
   
           $actual = GET_BODY "/modules/negotiation/$_/compressed/",
               'Accept-Language' => $ext;
           my_chomp();
  -        ok ($actual eq "index.html.$ext.gz");
  +        ok t_cmp($actual,
  +                 "index.html.$ext.gz",
  +                 "Verify with a default language Accept-Language still ".
  +                   "obeyed (compression on)");
   
           $actual = GET_BODY "/modules/negotiation/$_/two/index",
               'Accept-Language' => $ext;
           my_chomp();
  -        ok ($actual eq "index.$ext.html");
  +        ok t_cmp($actual,
  +                 "index.$ext.html",
  +                 "Verify with a default language Accept-Language still obeyed");
   
       }
   }
  @@ -98,31 +118,43 @@
   $actual = GET_BODY "/modules/negotiation/$en/",
       'Accept-Language' => "$en; q=0.1, $fr; q=0.4, $fu; q=0.9, $de; q=0.2";
   my_chomp();
  -ok ($actual eq "index.html.$fu");
  +ok t_cmp($actual,
  +         "index.html.$fu",
  +         "fu has a higher quality rating, so we expect fu");
   
   $actual = GET_BODY "/modules/negotiation/$en/two/index",
       'Accept-Language' => "$en; q=0.1, $fr; q=0.4, $fu; q=0.9, $de; q=0.2";
   my_chomp();
  -ok ($actual eq "index.$fu.html");
  +ok t_cmp($actual,
  +         "index.$fu.html",
  +         "fu has a higher quality rating, so we expect fu");
   
   $actual = GET_BODY "/modules/negotiation/$en/compressed/",
       'Accept-Language' => "$en; q=0.1, $fr; q=0.4, $fu; q=0.9, $de; q=0.2";
   my_chomp();
  -ok ($actual eq "index.html.$fu.gz");
  +ok t_cmp($actual,
  +         "index.html.$fu.gz",
  +         "fu has a higher quality rating, so we expect fu");
   
   ## 'bu' has the highest quality rating, but is non-existant,
   ## so we expect the next highest rated 'fr' content to be returned.
   $actual = GET_BODY "/modules/negotiation/$en/",
       'Accept-Language' => "$en; q=0.1, $fr; q=0.4, $bu; q=1.0";
   my_chomp();
  -ok ($actual eq "index.html.$fr");
  +ok t_cmp($actual,
  +         "index.html.$fr",
  +         "bu has the highest quality but is non-existant, so fr is next best");
   
   $actual = GET_BODY "/modules/negotiation/$en/two/index",
       'Accept-Language' => "$en; q=0.1, $fr; q=0.4, $bu; q=1.0";
   my_chomp();
  -ok ($actual eq "index.$fr.html");
  +ok t_cmp($actual,
  +         "index.$fr.html",
  +         "bu has the highest quality but is non-existant, so fr is next best");
   
   $actual = GET_BODY "/modules/negotiation/$en/compressed/",
       'Accept-Language' => "$en; q=0.1, $fr; q=0.4, $bu; q=1.0";
   my_chomp();
  -ok ($actual eq "index.html.$fr.gz");
  +ok t_cmp($actual,
  +         "index.html.$fr.gz",
  +         "bu has the highest quality but is non-existant, so fr is next best");