(command.CommandList
  children: [
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'Test custom diff function name patterns'>)}
        )
      ]
    )
    (C {(.)} {(./test-lib.sh)})
    (C {(test_expect_success)} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\t# a non-trivial custom pattern\n'> 
          <'\tgit config diff.custom1.funcname "!static\n'> <'!String\n'> <'[^ \t].*s.*" &&\n'> <'\n'> <'\t# a custom pattern which matches to end of line\n'> 
          <'\tgit config diff.custom2.funcname "......Beer\\$" &&\n'> <'\n'> <'\t# alternation in pattern\n'> <'\tgit config diff.custom3.funcname "Beer$" &&\n'> 
          <'\tgit config diff.custom3.xfuncname "^[ \t]*((public|static).*)$" &&\n'> <'\n'> <'\t# for regexp compilation tests\n'> <'\techo A >A.java &&\n'> <'\techo B >B.java\n'>
        )
      }
    )
    (command.Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (lhs_expr.LhsName name:diffpatterns)
          op: Equal
          rhs: 
            {
              (DQ ('\n') ('\tada\n') ('\tbibtex\n') ('\tcpp\n') ('\tcsharp\n') ('\tcss\n') ('\tfortran\n') 
                ('\tfountain\n') ('\thtml\n') ('\tjava\n') ('\tmatlab\n') ('\tobjc\n') ('\tpascal\n') ('\tperl\n') ('\tphp\n') ('\tpython\n') 
                ('\truby\n') ('\ttex\n') ('\tcustom1\n') ('\tcustom2\n') ('\tcustom3\n')
              )
            }
        )
      ]
    )
    (command.ForEach
      iter_name: p
      iter_words: [{($ VSub_DollarName '$diffpatterns')}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (C {(test_expect_success)} 
              {(DQ ('builtin ') ($ VSub_DollarName '$p') (' pattern compiles'))} 
              {
                (SQ <'\n'> <'\t\techo "*.java diff=$p" >.gitattributes &&\n'> 
                  <'\t\ttest_expect_code 1 git diff --no-index \\\n'> <'\t\t\tA.java B.java 2>msg &&\n'> <'\t\ttest_i18ngrep ! fatal msg &&\n'> 
                  <'\t\ttest_i18ngrep ! error msg\n'> <'\t'>
                )
              }
            )
            (C {(test_expect_success)} 
              {(DQ ('builtin ') ($ VSub_DollarName '$p') (' wordRegex pattern compiles'))} 
              {
                (SQ <'\n'> <'\t\techo "*.java diff=$p" >.gitattributes &&\n'> 
                  <'\t\ttest_expect_code 1 git diff --no-index --word-diff \\\n'> <'\t\t\tA.java B.java 2>msg &&\n'> <'\t\ttest_i18ngrep ! fatal msg &&\n'> 
                  <'\t\ttest_i18ngrep ! error msg\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (C {(test_expect_success)} {(SQ <'last regexp must not be negated'>)} 
      {
        (SQ <'\n'> <'\techo "*.java diff=java" >.gitattributes &&\n'> 
          <'\ttest_config diff.java.funcname "!static" &&\n'> <'\ttest_expect_code 128 git diff --no-index A.java B.java 2>msg &&\n'> 
          <'\ttest_i18ngrep ": Last expression must not be negated:" msg\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'setup hunk header tests'>)} 
      {
        (SQ <'\n'> <'\tfor i in $diffpatterns\n'> <'\tdo\n'> <'\t\techo "$i-* diff=$i"\n'> 
          <'\tdone > .gitattributes &&\n'> <'\n'> <'\t# add all test files to the index\n'> <'\t(\n'> <'\t\tcd "$TEST_DIRECTORY"/t4018 &&\n'> 
          <'\t\tgit --git-dir="$TRASH_DIRECTORY/.git" add .\n'> <'\t) &&\n'> <'\n'> <'\t# place modified files in the worktree\n'> <'\tfor i in $(git ls-files)\n'> 
          <'\tdo\n'> <'\t\tsed -e "s/ChangeMe/IWasChanged/" <"$TEST_DIRECTORY/t4018/$i" >"$i" || return 1\n'> <'\tdone\n'>
        )
      }
    )
    (command.ForEach
      iter_name: i
      iter_words: [
        {
          (word_part.CommandSubPart
            command_list: (command.CommandList children:[(C {(git)} {(ls-files)})])
            left_token: <Left_CommandSub '$('>
          )
        }
      ]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.SimpleCommand
                      words: [{(grep)} {(broken)} {(DQ ($ VSub_DollarName '$i'))}]
                      redirects: [
                        (redir.Redir
                          op: <Redir_Great '>'>
                          fd: 16777215
                          arg_word: {(/dev/null)}
                        )
                        (redir.Redir
                          op: <Redir_GreatAnd '2>&'>
                          fd: 2
                          arg_word: {(1)}
                        )
                      ]
                    )
                  ]
                  action: [
                    (command.Assignment
                      keyword: Assign_None
                      pairs: [(assign_pair lhs:(lhs_expr.LhsName name:result) op:Equal rhs:{(failure)})]
                    )
                  ]
                )
              ]
              else_action: [
                (command.Assignment
                  keyword: Assign_None
                  pairs: [(assign_pair lhs:(lhs_expr.LhsName name:result) op:Equal rhs:{(success)})]
                )
              ]
            )
            (C {(test_expect_) ($ VSub_DollarName '$result')} 
              {(DQ ('hunk header: ') ($ VSub_DollarName '$i'))} 
              {
                (DQ ('\n') ("\t\ttest_when_finished 'cat actual' &&\t# for debugging only\n") 
                  ('\t\tgit diff -U1 ') ($ VSub_DollarName '$i') (' >actual &&\n') ("\t\tgrep '@@ .* @@.*RIGHT' actual\n") ('\t')
                )
              }
            )
          ]
        )
    )
    (C {(test_done)})
  ]
)