(CommandList
  children: [
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:test_description)
          op: Equal
          rhs: {(SQ <'Test diff/status color escape codes'>)}
          spids: [13]
        )
      ]
      spids: [13]
    )
    (C {(.)} {(./test-lib.sh)})
    (FuncDef
      name: color
      body: 
        (BraceGroup
          children: [
            (AndOr
              ops: [Op_DAmp]
              children: [
                (Assignment
                  keyword: Assign_None
                  pairs: [
                    (assign_pair
                      lhs: (LhsName name:actual)
                      op: Equal
                      rhs: 
                        {
                          (CommandSubPart
                            command_list: 
                              (CommandList
                                children: [
                                  (C {(git)} {(config)} {(--get-color)} {(no.such.slot)} 
                                    {(DQ ($ VSub_Number '$1'))}
                                  )
                                ]
                              )
                            left_token: <Left_CommandSub '$('>
                            spids: [31 43]
                          )
                        }
                      spids: [30]
                    )
                  ]
                  spids: [30]
                )
                (C {(test)} {(DQ ($ VSub_Name '$actual'))} {(Lit_Other '=')} 
                  {(DQ ('\x1b') ($ VSub_Number '$2'))}
                )
              ]
            )
          ]
          spids: [27]
        )
      spids: [23 26]
    )
    (FuncDef
      name: invalid_color
      body: 
        (BraceGroup
          children: [
            (C {(test_must_fail)} {(git)} {(config)} {(--get-color)} {(no.such.slot)} 
              {(DQ ($ VSub_Number '$1'))}
            )
          ]
          spids: [68]
        )
      spids: [64 67]
    )
    (C {(test_expect_success)} {(SQ <reset>)} {(SQ <'\n'> <'\tcolor "reset" "[m"\n'>)})
    (C {(test_expect_success)} {(SQ <'attribute before color name'>)} 
      {(SQ <'\n'> <'\tcolor "bold red" "[1;31m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'color name before attribute'>)} 
      {(SQ <'\n'> <'\tcolor "red bold" "[1;31m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'attr fg bg'>)} 
      {(SQ <'\n'> <'\tcolor "ul blue red" "[4;34;41m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'fg attr bg'>)} 
      {(SQ <'\n'> <'\tcolor "blue ul red" "[4;34;41m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'fg bg attr'>)} 
      {(SQ <'\n'> <'\tcolor "blue red ul" "[4;34;41m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'fg bg attr...'>)} 
      {(SQ <'\n'> <'\tcolor "blue bold dim ul blink reverse" "[1;2;4;5;7;34m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'attr negation'>)} 
      {(SQ <'\n'> <'\tcolor "nobold nodim noul noblink noreverse" "[22;24;25;27m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'"no-" variant of negation'>)} 
      {(SQ <'\n'> <'\tcolor "no-bold no-blink" "[22;25m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'long color specification'>)} 
      {(SQ <'\n'> <'\tcolor "254 255 bold dim ul blink reverse" "[1;2;4;5;7;38;5;254;48;5;255m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'absurdly long color specification'>)} 
      {
        (SQ <'\n'> <'\tcolor \\\n'> <'\t  "#ffffff #ffffff bold nobold dim nodim italic noitalic\n'> 
          <'\t   ul noul blink noblink reverse noreverse strike nostrike" \\\n'> <'\t  "[1;2;3;4;5;7;9;22;23;24;25;27;29;38;2;255;255;255;48;2;255;255;255m"\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'0-7 are aliases for basic ANSI color names'>)} 
      {(SQ <'\n'> <'\tcolor "0 7" "[30;47m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'256 colors'>)} 
      {(SQ <'\n'> <'\tcolor "254 bold 255" "[1;38;5;254;48;5;255m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'24-bit colors'>)} 
      {(SQ <'\n'> <'\tcolor "#ff00ff black" "[38;2;255;0;255;40m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'"normal" yields no color at all"'>)} 
      {(SQ <'\n'> <'\tcolor "normal black" "[40m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'-1 is a synonym for "normal"'>)} 
      {(SQ <'\n'> <'\tcolor "-1 black" "[40m"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'color too small'>)} {(SQ <'\n'> <'\tinvalid_color "-2"\n'>)})
    (C {(test_expect_success)} {(SQ <'color too big'>)} {(SQ <'\n'> <'\tinvalid_color "256"\n'>)})
    (C {(test_expect_success)} {(SQ <'extra character after color number'>)} 
      {(SQ <'\n'> <'\tinvalid_color "3X"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'extra character after color name'>)} 
      {(SQ <'\n'> <'\tinvalid_color "redX"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'extra character after attribute'>)} 
      {(SQ <'\n'> <'\tinvalid_color "dimX"\n'>)}
    )
    (C {(test_expect_success)} {(SQ <'unknown color slots are ignored (diff)'>)} 
      {
        (SQ <'\n'> <'\tgit config color.diff.nosuchslotwilleverbedefined white &&\n'> 
          <'\tgit diff --color\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'unknown color slots are ignored (branch)'>)} 
      {
        (SQ <'\n'> <'\tgit config color.branch.nosuchslotwilleverbedefined white &&\n'> 
          <'\tgit branch -a\n'>
        )
      }
    )
    (C {(test_expect_success)} {(SQ <'unknown color slots are ignored (status)'>)} 
      {
        (SQ <'\n'> <'\tgit config color.status.nosuchslotwilleverbedefined white &&\n'> 
          <'\t{ git status; ret=$?; } &&\n'> <'\tcase $ret in 0|1) : ok ;; *) false ;; esac\n'>
        )
      }
    )
    (C {(test_done)})
  ]
)