(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'Test custom diff function name patterns'>)}
          spids: [13]
        )
      ]
      spids: [13]
    )
    (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'>
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (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')
              )
            }
          spids: [50]
        )
      ]
      spids: [50]
    )
    (ForEach
      iter_name: p
      iter_words: [{($ VSub_Name '$diffpatterns')}]
      do_arg_iter: F
      body: 
        (DoGroup
          children: [
            (C {(test_expect_success)} {(DQ ('builtin ') ($ VSub_Name '$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_Name '$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'>
                )
              }
            )
          ]
          spids: [84 124]
        )
      spids: [81 16777215]
    )
    (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'>
        )
      }
    )
    (ForEach
      iter_name: i
      iter_words: [
        {
          (CommandSubPart
            command_list: (CommandList children:[(C {(git)} {(ls-files)})])
            left_token: <Left_CommandSub '$('>
            spids: [178 182]
          )
        }
      ]
      do_arg_iter: F
      body: 
        (DoGroup
          children: [
            (If
              arms: [
                (if_arm
                  cond: [
                    (SimpleCommand
                      words: [{(grep)} {(broken)} {(DQ ($ VSub_Name '$i'))}]
                      redirects: [
                        (Redir
                          op_id: Redir_Great
                          fd: 16777215
                          arg_word: {(/dev/null)}
                          spids: [197]
                        )
                        (Redir
                          op_id: Redir_GreatAnd
                          fd: 2
                          arg_word: {(1)}
                          spids: [200]
                        )
                      ]
                    )
                  ]
                  action: [
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:result)
                          op: Equal
                          rhs: {(failure)}
                          spids: [207]
                        )
                      ]
                      spids: [207]
                    )
                  ]
                  spids: [16777215 204]
                )
              ]
              else_action: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:result)
                      op: Equal
                      rhs: {(success)}
                      spids: [214]
                    )
                  ]
                  spids: [214]
                )
              ]
              spids: [211 218]
            )
            (C {(test_expect_) ($ VSub_Name '$result')} {(DQ ('hunk header: ') ($ VSub_Name '$i'))} 
              {
                (DQ ('\n') ("\t\ttest_when_finished 'cat actual' &&\t# for debugging only\n") 
                  ('\t\tgit diff -U1 ') ($ VSub_Name '$i') (' >actual &&\n') ("\t\tgrep '@@ .* @@.*RIGHT' actual\n") ('\t')
                )
              }
            )
          ]
          spids: [184 239]
        )
      spids: [177 16777215]
    )
    (C {(test_done)})
  ]
)