(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'word diff colors'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (C {<.>} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) <'/diff-lib.sh'>})
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<pre.simple>})
        (redir
          op: <Id.Redir_DLessDash '<<-'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 34
              stdin_parts: [<'h(4)\n'> <'\n'> <'a = b + c\n'>]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<post.simple>})
        (redir
          op: <Id.Redir_DLessDash '<<-'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 51
              stdin_parts: [
                <'h(4),hh[44]\n'>
                <'\n'>
                <'a = b + c\n'>
                <'\n'>
                <'aa = a\n'>
                <'\n'>
                <'aeff = aeff * ( aaa )\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir
          op: <Id.Redir_Great '>'>
          loc: (redir_loc.Fd fd:1)
          arg: {<expect.letter-runs-are-words>}
        )
        (redir
          op: <Id.Redir_DLessDash '<<-'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 73
              stdin_parts: [
                <'<BOLD>diff --git a/pre b/post<RESET>\n'>
                <'<BOLD>index 330b04f..5ed8eff 100644<RESET>\n'>
                <'<BOLD>--- a/pre<RESET>\n'>
                <'<BOLD>+++ b/post<RESET>\n'>
                <'<CYAN>@@ -1,3 +1,7 @@<RESET>\n'>
                <'h(4),<GREEN>hh<RESET>[44]\n'>
                <'\n'>
                <'a = b + c<RESET>\n'>
                <'\n'>
                <'<GREEN>aa = a<RESET>\n'>
                <'\n'>
                <'<GREEN>aeff = aeff * ( aaa<RESET> )\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      words: [{<cat>}]
      redirects: [
        (redir
          op: <Id.Redir_Great '>'>
          loc: (redir_loc.Fd fd:1)
          arg: {<expect.non-whitespace-is-word>}
        )
        (redir
          op: <Id.Redir_DLessDash '<<-'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.MultiLine
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'>) <OF>}
              here_end_span_id: 95
              stdin_parts: [
                <'<BOLD>diff --git a/pre b/post<RESET>\n'>
                <'<BOLD>index 330b04f..5ed8eff 100644<RESET>\n'>
                <'<BOLD>--- a/pre<RESET>\n'>
                <'<BOLD>+++ b/post<RESET>\n'>
                <'<CYAN>@@ -1,3 +1,7 @@<RESET>\n'>
                <'h(4)<GREEN>,hh[44]<RESET>\n'>
                <'\n'>
                <'a = b + c<RESET>\n'>
                <'\n'>
                <'<GREEN>aa = a<RESET>\n'>
                <'\n'>
                <'<GREEN>aeff = aeff * ( aaa )<RESET>\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.ShFunction
      name: word_diff
      body: 
        (BraceGroup
          children: [
            (command.AndOr
              ops: [Id.Op_DAmp Id.Op_DAmp]
              children: [
                (command.Simple
                  words: [
                    {<test_must_fail>}
                    {<git>}
                    {<diff>}
                    {<--no-index>}
                    {(DQ ($ Id.VSub_At '$@'))}
                    {<pre>}
                    {<post>}
                  ]
                  redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<output>})]
                  do_fork: T
                )
                (command.Simple
                  words: [{<test_decode_color>}]
                  redirects: [
                    (redir
                      op: <Id.Redir_Less '<'>
                      loc: (redir_loc.Fd fd:0)
                      arg: {<output>}
                    )
                    (redir
                      op: <Id.Redir_Great '>'>
                      loc: (redir_loc.Fd fd:1)
                      arg: {<output.decrypted>}
                    )
                  ]
                  do_fork: T
                )
                (C {<test_cmp>} {<expect>} {<output.decrypted>})
              ]
            )
          ]
        )
    )
    (command.ShFunction
      name: test_language_driver
      body: 
        (BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:lang)
                  op: assign_op.Equal
                  rhs: {($ Id.VSub_Number '$1')}
                  spids: [155]
                )
              ]
            )
            (C {<test_expect_success>} {(DQ <'diff driver \''> ($ Id.VSub_DollarName '$lang') <'\''>)} 
              {(SQ <'\n'> <'\t\tcp "$TEST_DIRECTORY/t4034/'>) (DQ ($ Id.VSub_DollarName '$lang')) 
                (SQ <'/pre" \\\n'> <'\t\t\t"$TEST_DIRECTORY/t4034/'>) (DQ ($ Id.VSub_DollarName '$lang')) (SQ <'/post" \\\n'> <'\t\t\t"$TEST_DIRECTORY/t4034/'>) 
                (DQ ($ Id.VSub_DollarName '$lang')) (SQ <'/expect" . &&\n'> <'\t\techo "* diff='>) (DQ ($ Id.VSub_DollarName '$lang')) 
                (SQ <'" >.gitattributes &&\n'> <'\t\tword_diff --color-words\n'> <'\t'>)
              }
            )
          ]
        )
    )
    (C {<test_expect_success>} {<setup>} 
      {
        (SQ <'\n'> <'\tgit config diff.color.old red &&\n'> <'\tgit config diff.color.new green &&\n'> 
          <'\tgit config diff.color.func magenta\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'set up pre and post with runs of whitespace'>)} 
      {(SQ <'\n'> <'\tcp pre.simple pre &&\n'> <'\tcp post.simple post\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'word diff with runs of whitespace'>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\t\t<BOLD>diff --git a/pre b/post<RESET>\n'> 
          <'\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n'> <'\t\t<BOLD>--- a/pre<RESET>\n'> <'\t\t<BOLD>+++ b/post<RESET>\n'> 
          <'\t\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n'> <'\t\t<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>\n'> <'\n'> <'\t\ta = b + c<RESET>\n'> <'\n'> 
          <'\t\t<GREEN>aa = a<RESET>\n'> <'\n'> <'\t\t<GREEN>aeff = aeff * ( aaa )<RESET>\n'> <'\tEOF\n'> <'\tword_diff --color-words &&\n'> 
          <'\tword_diff --word-diff=color &&\n'> <'\tword_diff --color --word-diff=color\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'--word-diff=porcelain'>)} 
      {(SQ <'\n'> <'\tsed '>) <'s/'> <Id.Lit_Pound '#'> <.> <Id.Lit_Star '*'> <Id.Lit_Other '$'> <'//'> 
        (SQ <' >expect <<-\\EOF &&\n'> <'\t\tdiff --git a/pre b/post\n'> 
          <'\t\tindex 330b04f..5ed8eff 100644\n'> <'\t\t--- a/pre\n'> <'\t\t+++ b/post\n'> <'\t\t@@ -1,3 +1,7 @@\n'> <'\t\t-h(4)\n'> <'\t\t+h(4),hh[44]\n'> 
          <'\t\t~\n'> <'\t\t # significant space\n'> <'\t\t~\n'> <'\t\t a = b + c\n'> <'\t\t~\n'> <'\t\t~\n'> <'\t\t+aa = a\n'> 
          <'\t\t~\n'> <'\t\t~\n'> <'\t\t+aeff = aeff * ( aaa )\n'> <'\t\t~\n'> <'\tEOF\n'> 
          <'\tword_diff --word-diff=porcelain\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'--word-diff=plain'>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\t\tdiff --git a/pre b/post\n'> 
          <'\t\tindex 330b04f..5ed8eff 100644\n'> <'\t\t--- a/pre\n'> <'\t\t+++ b/post\n'> <'\t\t@@ -1,3 +1,7 @@\n'> <'\t\t[-h(4)-]{+h(4),hh[44]+}\n'> 
          <'\n'> <'\t\ta = b + c\n'> <'\n'> <'\t\t{+aa = a+}\n'> <'\n'> <'\t\t{+aeff = aeff * ( aaa )+}\n'> <'\tEOF\n'> 
          <'\tword_diff --word-diff=plain &&\n'> <'\tword_diff --word-diff=plain --no-color\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'--word-diff=plain --color'>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\t\t<BOLD>diff --git a/pre b/post<RESET>\n'> 
          <'\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n'> <'\t\t<BOLD>--- a/pre<RESET>\n'> <'\t\t<BOLD>+++ b/post<RESET>\n'> 
          <'\t\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n'> <'\t\t<RED>[-h(4)-]<RESET><GREEN>{+h(4),hh[44]+}<RESET>\n'> <'\n'> <'\t\ta = b + c<RESET>\n'> <'\n'> 
          <'\t\t<GREEN>{+aa = a+}<RESET>\n'> <'\n'> <'\t\t<GREEN>{+aeff = aeff * ( aaa )+}<RESET>\n'> <'\tEOF\n'> 
          <'\tword_diff --word-diff=plain --color\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'word diff without context'>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\t\t<BOLD>diff --git a/pre b/post<RESET>\n'> 
          <'\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n'> <'\t\t<BOLD>--- a/pre<RESET>\n'> <'\t\t<BOLD>+++ b/post<RESET>\n'> <'\t\t<CYAN>@@ -1 +1 @@<RESET>\n'> 
          <'\t\t<RED>h(4)<RESET><GREEN>h(4),hh[44]<RESET>\n'> <'\t\t<CYAN>@@ -3,0 +4,4 @@<RESET> <RESET><MAGENTA>a = b + c<RESET>\n'> <'\n'> 
          <'\t\t<GREEN>aa = a<RESET>\n'> <'\n'> <'\t\t<GREEN>aeff = aeff * ( aaa )<RESET>\n'> <'\tEOF\n'> 
          <'\tword_diff --color-words --unified=0\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'word diff with a regular expression'>)} 
      {
        (SQ <'\n'> <'\tcp expect.letter-runs-are-words expect &&\n'> 
          <'\tword_diff --color-words="[a-z]+"\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'set up a diff driver'>)} 
      {
        (SQ <'\n'> <'\tgit config diff.testdriver.wordRegex "[^[:space:]]" &&\n'> 
          <'\tcat <<-\\EOF >.gitattributes\n'> <'\t\tpre diff=testdriver\n'> <'\t\tpost diff=testdriver\n'> <'\tEOF\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'option overrides .gitattributes'>)} 
      {
        (SQ <'\n'> <'\tcp expect.letter-runs-are-words expect &&\n'> 
          <'\tword_diff --color-words="[a-z]+"\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'use regex supplied by driver'>)} 
      {(SQ <'\n'> <'\tcp expect.non-whitespace-is-word expect &&\n'> <'\tword_diff --color-words\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'set up diff.wordRegex option'>)} 
      {(SQ <'\n'> <'\tgit config diff.wordRegex "[[:alnum:]]+"\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'command-line overrides config'>)} 
      {
        (SQ <'\n'> <'\tcp expect.letter-runs-are-words expect &&\n'> 
          <'\tword_diff --color-words="[a-z]+"\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'command-line overrides config: --word-diff-regex'>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\t\t<BOLD>diff --git a/pre b/post<RESET>\n'> 
          <'\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n'> <'\t\t<BOLD>--- a/pre<RESET>\n'> <'\t\t<BOLD>+++ b/post<RESET>\n'> 
          <'\t\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n'> <'\t\th(4),<GREEN>{+hh+}<RESET>[44]\n'> <'\n'> <'\t\ta = b + c<RESET>\n'> <'\n'> 
          <'\t\t<GREEN>{+aa = a+}<RESET>\n'> <'\n'> <'\t\t<GREEN>{+aeff = aeff * ( aaa+}<RESET> )\n'> <'\tEOF\n'> 
          <'\tword_diff --color --word-diff-regex="[a-z]+"\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'.gitattributes override config'>)} 
      {(SQ <'\n'> <'\tcp expect.non-whitespace-is-word expect &&\n'> <'\tword_diff --color-words\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'setup: remove diff driver regex'>)} 
      {(SQ <'\n'> <'\ttest_unconfig diff.testdriver.wordRegex\n'>)}
    )
    (C {<test_expect_success>} {(SQ <'use configured regex'>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\t\t<BOLD>diff --git a/pre b/post<RESET>\n'> 
          <'\t\t<BOLD>index 330b04f..5ed8eff 100644<RESET>\n'> <'\t\t<BOLD>--- a/pre<RESET>\n'> <'\t\t<BOLD>+++ b/post<RESET>\n'> 
          <'\t\t<CYAN>@@ -1,3 +1,7 @@<RESET>\n'> <'\t\th(4),<GREEN>hh[44<RESET>]\n'> <'\n'> <'\t\ta = b + c<RESET>\n'> <'\n'> 
          <'\t\t<GREEN>aa = a<RESET>\n'> <'\n'> <'\t\t<GREEN>aeff = aeff * ( aaa<RESET> )\n'> <'\tEOF\n'> <'\tword_diff --color-words\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'test parsing words for newline'>)} 
      {
        (SQ <'\n'> <'\techo "aaa (aaa)" >pre &&\n'> <'\techo "aaa (aaa) aaa" >post &&\n'> 
          <'\tcat >expect <<-\\EOF &&\n'> <'\t\t<BOLD>diff --git a/pre b/post<RESET>\n'> <'\t\t<BOLD>index c29453b..be22f37 100644<RESET>\n'> 
          <'\t\t<BOLD>--- a/pre<RESET>\n'> <'\t\t<BOLD>+++ b/post<RESET>\n'> <'\t\t<CYAN>@@ -1 +1 @@<RESET>\n'> 
          <'\t\taaa (aaa) <GREEN>aaa<RESET>\n'> <'\tEOF\n'> <'\tword_diff --color-words="a+"\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'test when words are only removed at the end'>)} 
      {
        (SQ <'\n'> <'\techo "(:" >pre &&\n'> <'\techo "(" >post &&\n'> <'\tcat >expect <<-\\EOF &&\n'> 
          <'\t\t<BOLD>diff --git a/pre b/post<RESET>\n'> <'\t\t<BOLD>index 289cb9d..2d06f37 100644<RESET>\n'> <'\t\t<BOLD>--- a/pre<RESET>\n'> 
          <'\t\t<BOLD>+++ b/post<RESET>\n'> <'\t\t<CYAN>@@ -1 +1 @@<RESET>\n'> <'\t\t(<RED>:<RESET>\n'> <'\tEOF\n'> 
          <'\tword_diff --color-words=.\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'--word-diff=none'>)} 
      {
        (SQ <'\n'> <'\techo "(:" >pre &&\n'> <'\techo "(" >post &&\n'> <'\tcat >expect <<-\\EOF &&\n'> 
          <'\t\tdiff --git a/pre b/post\n'> <'\t\tindex 289cb9d..2d06f37 100644\n'> <'\t\t--- a/pre\n'> <'\t\t+++ b/post\n'> <'\t\t@@ -1 +1 @@\n'> 
          <'\t\t-(:\n'> <'\t\t+(\n'> <'\tEOF\n'> <'\tword_diff --word-diff=plain --word-diff=none\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'unset default driver'>)} 
      {(SQ <'\n'> <'\ttest_unconfig diff.wordregex\n'>)}
    )
    (C {<test_language_driver>} {<ada>})
    (C {<test_language_driver>} {<bibtex>})
    (C {<test_language_driver>} {<cpp>})
    (C {<test_language_driver>} {<csharp>})
    (C {<test_language_driver>} {<css>})
    (C {<test_language_driver>} {<fortran>})
    (C {<test_language_driver>} {<html>})
    (C {<test_language_driver>} {<java>})
    (C {<test_language_driver>} {<matlab>})
    (C {<test_language_driver>} {<objc>})
    (C {<test_language_driver>} {<pascal>})
    (C {<test_language_driver>} {<perl>})
    (C {<test_language_driver>} {<php>})
    (C {<test_language_driver>} {<python>})
    (C {<test_language_driver>} {<ruby>})
    (C {<test_language_driver>} {<tex>})
    (C {<test_expect_success>} {(SQ <'word-diff with diff.sbe'>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\tdiff --git a/pre b/post\n'> 
          <'\tindex a1a53b5..bc8fe6d 100644\n'> <'\t--- a/pre\n'> <'\t+++ b/post\n'> <'\t@@ -1,3 +1,3 @@\n'> <'\ta\n'> <'\n'> <'\t[-b-]{+c+}\n'> 
          <'\tEOF\n'> <'\tcat >pre <<-\\EOF &&\n'> <'\ta\n'> <'\n'> <'\tb\n'> <'\tEOF\n'> <'\tcat >post <<-\\EOF &&\n'> <'\ta\n'> 
          <'\n'> <'\tc\n'> <'\tEOF\n'> <'\ttest_config diff.suppress-blank-empty true &&\n'> 
          <'\tword_diff --word-diff=plain\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'word-diff with no newline at EOF'>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\tdiff --git a/pre b/post\n'> 
          <'\tindex 7bf316e..3dd0303 100644\n'> <'\t--- a/pre\n'> <'\t+++ b/post\n'> <'\t@@ -1 +1 @@\n'> <'\ta a [-a-]{+ab+} a a\n'> <'\tEOF\n'> 
          <'\tprintf "%s" "a a a a a" >pre &&\n'> <'\tprintf "%s" "a a ab a a" >post &&\n'> <'\tword_diff --word-diff=plain\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'setup history with two files'>)} 
      {
        (SQ <'\n'> <'\techo "a b; c" >a.tex &&\n'> <'\techo "a b; c" >z.txt &&\n'> 
          <'\tgit add a.tex z.txt &&\n'> <'\tgit commit -minitial &&\n'> <'\n'> <'\t# modify both\n'> <'\techo "a bx; c" >a.tex &&\n'> 
          <'\techo "a bx; c" >z.txt &&\n'> <'\tgit commit -mmodified -a\n'>
        )
      }
    )
    (C {<test_expect_success>} {(SQ <'wordRegex for the first file does not apply to the second'>)} 
      {
        (SQ <'\n'> <'\techo "*.tex diff=tex" >.gitattributes &&\n'> 
          <'\ttest_config diff.tex.wordRegex "[a-z]+|." &&\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\t\tdiff --git a/a.tex b/a.tex\n'> <'\t\t--- a/a.tex\n'> 
          <'\t\t+++ b/a.tex\n'> <'\t\t@@ -1 +1 @@\n'> <'\t\ta [-b-]{+bx+}; c\n'> <'\t\tdiff --git a/z.txt b/z.txt\n'> 
          <'\t\t--- a/z.txt\n'> <'\t\t+++ b/z.txt\n'> <'\t\t@@ -1 +1 @@\n'> <'\t\ta [-b;-]{+bx;+} c\n'> <'\tEOF\n'> 
          <'\tgit diff --word-diff HEAD~ >actual &&\n'> <'\tcompare_diff_patch expect actual\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)