(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'Test custom diff function name patterns'>)} 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'> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:diffpatterns) op: assign_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] ) ] ) (command.ForEach iter_name: p iter_words: [{($ Id.VSub_DollarName '$diffpatterns')}] do_arg_iter: F body: (command.DoGroup children: [ (C {<test_expect_success>} {(DQ <'builtin '> ($ Id.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 '> ($ Id.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: [{(command_sub left_token:<Id.Left_DollarParen '$('> child:(C {<git>} {<ls-files>}))}] do_arg_iter: F body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: [ (command.Simple words: [{<grep>} {<broken>} {(DQ ($ Id.VSub_DollarName '$i'))}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'/dev/null'>} ) (redir op: <Id.Redir_GreatAnd '2>&'> loc: (redir_loc.Fd fd:2) arg: {<1>} ) ] do_fork: T ) ] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:result) op: assign_op.Equal rhs: {<failure>} spids: [207] ) ] ) ] spids: [187 204] ) ] else_action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:result) op: assign_op.Equal rhs: {<success>} spids: [214] ) ] ) ] ) (C {<test_expect_> ($ Id.VSub_DollarName '$result')} {(DQ <'hunk header: '> ($ Id.VSub_DollarName '$i'))} { (DQ <'\n'> <'\t\ttest_when_finished \'cat actual\' &&\t# for debugging only\n'> <'\t\tgit diff -U1 '> ($ Id.VSub_DollarName '$i') <' >actual &&\n'> <'\t\tgrep \'@@ .* @@.*RIGHT\' actual\n'> <'\t'> ) } ) ] ) ) (C {<test_done>}) ] )