(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: 
            {
              (SQ <"gitweb as standalone script (http status tests).\n"> <"\n"> 
                <"This test runs gitweb (git web interface) as a CGI script from the\n"> <"commandline, and checks that it returns the expected HTTP status\n"> <"code and message.">
              )
            }
          spids: [13]
        )
      ]
      spids: [13]
    )
    (C {(.)} {(./gitweb-lib.sh)})
    (AndOr
      children: [
        (SimpleCommand
          words: [{(perl)} {(-MHTTP) (Lit_Other ":") (Lit_Other ":") (Date)} {(-e)} {(0)}]
          redirects: [
            (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[52])
            (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[55])
          ]
        )
        (C {(test_set_prereq)} {(DATE_PARSER)})
      ]
      op_id: Op_DAmp
    )
    (AndOr
      children: [
        (SimpleCommand
          words: [{(perl)} {(-MTime) (Lit_Other ":") (Lit_Other ":") (ParseDate)} {(-e)} {(0)}]
          redirects: [
            (Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[75])
            (Redir op_id:Redir_GreatAnd fd:2 arg_word:{(1)} spids:[78])
          ]
        )
        (C {(test_set_prereq)} {(DATE_PARSER)})
      ]
      op_id: Op_DAmp
    )
    (C {(test_expect_success)} {(SQ <setup>)} 
      {(DQ ("\n") ("\ttest_commit 'SnapshotTests' 'i can has snapshot'\n"))}
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_DGreat fd:-1 arg_word:{(gitweb_config.perl)} spids:[110])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {("$feature{'snapshot'}{'override'} = 0;\n")}
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [113]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"snapshots: tgz only default format enabled">)} 
      {
        (SQ <"gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=tgz\" &&\n"> 
          <"    grep \"Status: 200 OK\" gitweb.output &&\n"> <"    gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=tbz2\" &&\n"> 
          <"    grep \"403 - Unsupported snapshot format\" gitweb.output &&\n"> <"    gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=txz\" &&\n"> 
          <"    grep \"403 - Snapshot format not allowed\" gitweb.output &&\n"> <"    gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=zip\" &&\n"> 
          <"    grep \"403 - Unsupported snapshot format\" gitweb.output">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_DGreat fd:-1 arg_word:{(gitweb_config.perl)} spids:[143])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {("$feature{'snapshot'}{'default'} = ['tgz','tbz2','txz','zip'];\n")}
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [146]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"snapshots: all enabled in default, use default disabled value">)} 
      {
        (SQ <"gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=tgz\" &&\n"> 
          <"    grep \"Status: 200 OK\" gitweb.output &&\n"> <"    gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=tbz2\" &&\n"> 
          <"    grep \"Status: 200 OK\" gitweb.output &&\n"> <"    gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=txz\" &&\n"> 
          <"    grep \"403 - Snapshot format not allowed\" gitweb.output &&\n"> <"    gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=zip\" &&\n"> 
          <"    grep \"Status: 200 OK\" gitweb.output">
        )
      }
    )
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_DGreat fd:-1 arg_word:{(gitweb_config.perl)} spids:[176])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {("$known_snapshot_formats{'zip'}{'disabled'} = 1;\n")}
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [179]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"snapshots: zip explicitly disabled">)} 
      {
        (SQ <"gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=zip\" &&\n"> 
          <"    grep \"403 - Snapshot format not allowed\" gitweb.output">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.output">)})
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_DGreat fd:-1 arg_word:{(gitweb_config.perl)} spids:[209])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {("$known_snapshot_formats{'tgz'}{'disabled'} = 0;\n")}
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [212]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"snapshots: tgz explicitly enabled">)} 
      {
        (SQ <"gitweb_run \"p=.git;a=snapshot;h=HEAD;sf=tgz\" &&\n"> 
          <"    grep \"Status: 200 OK\" gitweb.output">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.headers">)})
    (C {(test_expect_success)} {(SQ <"snapshots: good tree-ish id">)} 
      {
        (SQ <"\n"> <"\tgitweb_run \"p=.git;a=snapshot;h=master;sf=tgz\" &&\n"> 
          <"\tgrep \"Status: 200 OK\" gitweb.output\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.headers">)})
    (C {(test_expect_success)} {(SQ <"snapshots: bad tree-ish id">)} 
      {
        (SQ <"\n"> <"\tgitweb_run \"p=.git;a=snapshot;h=frizzumFrazzum;sf=tgz\" &&\n"> 
          <"\tgrep \"404 - Object does not exist\" gitweb.output\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.output">)})
    (C {(test_expect_success)} {(SQ <"snapshots: bad tree-ish id (tagged object)">)} 
      {
        (SQ <"\n"> <"\techo object > tag-object &&\n"> <"\tgit add tag-object &&\n"> 
          <"\ttest_tick && git commit -m \"Object to be tagged\" &&\n"> <"\tgit tag tagged-object $(git hash-object tag-object) &&\n"> 
          <"\tgitweb_run \"p=.git;a=snapshot;h=tagged-object;sf=tgz\" &&\n"> <"\tgrep \"400 - Object is not a tree-ish\" gitweb.output\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.output">)})
    (C {(test_expect_success)} {(SQ <"snapshots: good object id">)} 
      {
        (SQ <"\n"> <"\tID=$(git rev-parse --verify HEAD) &&\n"> 
          <"\tgitweb_run \"p=.git;a=snapshot;h=$ID;sf=tgz\" &&\n"> <"\tgrep \"Status: 200 OK\" gitweb.output\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.headers">)})
    (C {(test_expect_success)} {(SQ <"snapshots: bad object id">)} 
      {
        (SQ <"\n"> <"\tgitweb_run \"p=.git;a=snapshot;h=abcdef01234;sf=tgz\" &&\n"> 
          <"\tgrep \"404 - Object does not exist\" gitweb.output\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.output">)})
    (C {(test_expect_success)} {(DATE_PARSER)} {(SQ <"modification: feed last-modified">)} 
      {
        (SQ <"\n"> <"\tgitweb_run \"p=.git;a=atom;h=master\" &&\n"> 
          <"\tgrep \"Status: 200 OK\" gitweb.headers &&\n"> <"\tgrep \"Last-modified: Thu, 7 Apr 2005 22:14:13 +0000\" gitweb.headers\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.headers">)})
    (C {(test_expect_success)} {(DATE_PARSER)} {(SQ <"modification: feed if-modified-since (modified)">)} 
      {
        (SQ <"\n"> <"\tHTTP_IF_MODIFIED_SINCE=\"Wed, 6 Apr 2005 22:14:13 +0000\" &&\n"> 
          <"\texport HTTP_IF_MODIFIED_SINCE &&\n"> <"\ttest_when_finished \"unset HTTP_IF_MODIFIED_SINCE\" &&\n"> 
          <"\tgitweb_run \"p=.git;a=atom;h=master\" &&\n"> <"\tgrep \"Status: 200 OK\" gitweb.headers\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.headers">)})
    (C {(test_expect_success)} {(DATE_PARSER)} 
      {(SQ <"modification: feed if-modified-since (unmodified)">)} 
      {
        (SQ <"\n"> <"\tHTTP_IF_MODIFIED_SINCE=\"Thu, 7 Apr 2005 22:14:13 +0000\" &&\n"> 
          <"\texport HTTP_IF_MODIFIED_SINCE &&\n"> <"\ttest_when_finished \"unset HTTP_IF_MODIFIED_SINCE\" &&\n"> 
          <"\tgitweb_run \"p=.git;a=atom;h=master\" &&\n"> <"\tgrep \"Status: 304 Not Modified\" gitweb.headers\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.headers">)})
    (C {(test_expect_success)} {(DATE_PARSER)} {(SQ <"modification: snapshot last-modified">)} 
      {
        (SQ <"\n"> <"\tgitweb_run \"p=.git;a=snapshot;h=master;sf=tgz\" &&\n"> 
          <"\tgrep \"Status: 200 OK\" gitweb.headers &&\n"> <"\tgrep \"Last-modified: Thu, 7 Apr 2005 22:14:13 +0000\" gitweb.headers\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.headers">)})
    (C {(test_expect_success)} {(DATE_PARSER)} 
      {(SQ <"modification: snapshot if-modified-since (modified)">)} 
      {
        (SQ <"\n"> <"\tHTTP_IF_MODIFIED_SINCE=\"Wed, 6 Apr 2005 22:14:13 +0000\" &&\n"> 
          <"\texport HTTP_IF_MODIFIED_SINCE &&\n"> <"\ttest_when_finished \"unset HTTP_IF_MODIFIED_SINCE\" &&\n"> 
          <"\tgitweb_run \"p=.git;a=snapshot;h=master;sf=tgz\" &&\n"> <"\tgrep \"Status: 200 OK\" gitweb.headers\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.headers">)})
    (C {(test_expect_success)} {(DATE_PARSER)} 
      {(SQ <"modification: snapshot if-modified-since (unmodified)">)} 
      {
        (SQ <"\n"> <"\tHTTP_IF_MODIFIED_SINCE=\"Thu, 7 Apr 2005 22:14:13 +0000\" &&\n"> 
          <"\texport HTTP_IF_MODIFIED_SINCE &&\n"> <"\ttest_when_finished \"unset HTTP_IF_MODIFIED_SINCE\" &&\n"> 
          <"\tgitweb_run \"p=.git;a=snapshot;h=master;sf=tgz\" &&\n"> <"\tgrep \"Status: 304 Not Modified\" gitweb.headers\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.headers">)})
    (C {(test_expect_success)} {(DATE_PARSER)} {(SQ <"modification: tree snapshot">)} 
      {
        (SQ <"\n"> <"\tID=$(git rev-parse --verify HEAD^{tree}) &&\n"> 
          <"\tHTTP_IF_MODIFIED_SINCE=\"Wed, 6 Apr 2005 22:14:13 +0000\" &&\n"> <"\texport HTTP_IF_MODIFIED_SINCE &&\n"> 
          <"\ttest_when_finished \"unset HTTP_IF_MODIFIED_SINCE\" &&\n"> <"\tgitweb_run \"p=.git;a=snapshot;h=$ID;sf=tgz\" &&\n"> 
          <"\tgrep \"Status: 200 OK\" gitweb.headers &&\n"> <"\t! grep -i \"last-modified\" gitweb.headers\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.headers">)})
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_DGreat fd:-1 arg_word:{(gitweb_config.perl)} spids:[532])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {("our $maxload = -1;\n")}
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [535]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"load checking: load too high (default action)">)} 
      {
        (SQ <"\n"> <"\tgitweb_run \"p=.git\" &&\n"> 
          <"\tgrep \"Status: 503 Service Unavailable\" gitweb.headers &&\n"> <"\tgrep \"503 - The load average on the server is too high\" gitweb.body\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.headers">)})
    (SimpleCommand
      words: [{(cat)}]
      redirects: [
        (Redir op_id:Redir_DGreat fd:-1 arg_word:{(gitweb_config.perl)} spids:[565])
        (HereDoc
          op_id: Redir_DLess
          fd: -1
          body: {("our $maxload = undef;\n")}
          do_expansion: False
          here_end: EOF
          was_filled: True
          spids: [568]
        )
      ]
    )
    (C {(test_expect_success)} {(SQ <"invalid arguments: invalid regexp (in project search)">)} 
      {
        (SQ <"\n"> <"\tgitweb_run \"a=project_list;s=*\\.git;sr=1\" &&\n"> 
          <"\tgrep \"Status: 400\" gitweb.headers &&\n"> <"\tgrep \"400 - Invalid.*regexp\" gitweb.body\n">
        )
      }
    )
    (C {(test_debug)} {(SQ <"cat gitweb.headers">)})
    (C {(test_done)})
  ]
)