(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'log family learns --stdin'>)}
          spids: [13]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShFunction
      name: check
      body: 
        (BraceGroup
          children: [
            (command.ForEach
              iter_name: cmd
              iter_words: [{<rev-list>} {(DQ <'log --stat'>)}]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.AndOr
                      ops: [Id.Op_DAmp]
                      children: [
                        (command.ForEach
                          iter_name: i
                          iter_words: [{(DQ ($ Id.VSub_At '$@'))}]
                          do_arg_iter: F
                          body: 
                            (command.DoGroup
                              children: [
                                (C {<printf>} {(DQ <'%s'> <Id.Lit_Other '\\'> <n>)} 
                                  {($ Id.VSub_DollarName '$i')}
                                )
                              ]
                            )
                          redirects: [
                            (redir
                              op: <Id.Redir_Great '>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {<input>}
                            )
                          ]
                        )
                        (C {<test_expect_success>} 
                          {(DQ <'check '> ($ Id.VSub_DollarName '$cmd') <' '> ($ Id.VSub_Star '$*'))} 
                          {
                            (SQ <'\n'> <'\t\t\tgit $cmd $(cat input) >expect &&\n'> 
                              <'\t\t\tgit $cmd --stdin <input >actual &&\n'> <'\t\t\tsed -e "s/^/input /" input &&\n'> <'\t\t\tsed -e "s/^/output /" expect &&\n'> 
                              <'\t\t\ttest_cmp expect actual\n'> <'\t\t'>
                            )
                          }
                        )
                      ]
                    )
                  ]
                )
            )
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:them)
          op: assign_op.Equal
          rhs: {(SQ <'1 2 3 4 5 6 7'>)}
          spids: [106]
        )
      ]
    )
    (C {<test_expect_success>} {<setup>} 
      {
        (SQ <'\n'> <'\t(\n'> <'\t\tfor i in 0 $them\n'> <'\t\tdo\n'> <'\t\t\tfor j in $them\n'> 
          <'\t\t\tdo\n'> <'\t\t\t\techo $i.$j >file-$j &&\n'> <'\t\t\t\tgit add file-$j || exit\n'> <'\t\t\tdone &&\n'> 
          <'\t\t\ttest_tick &&\n'> <'\t\t\tgit commit -m $i || exit\n'> <'\t\tdone &&\n'> <'\t\tfor i in $them\n'> <'\t\tdo\n'> 
          <'\t\t\tgit checkout -b side-$i master~$i &&\n'> <'\t\t\techo updated $i >file-$i &&\n'> <'\t\t\tgit add file-$i &&\n'> <'\t\t\ttest_tick &&\n'> 
          <'\t\t\tgit commit -m side-$i || exit\n'> <'\t\tdone\n'> <'\t)\n'>
        )
      }
    )
    (C {<check>} {<master>})
    (C {<check>} {<side-1>} {<Id.Lit_Other '^'> <side-4>})
    (C {<check>} {<side-1>} {<Id.Lit_Other '^'> <side-7>} {<-->})
    (C {<check>} {<side-1>} {<Id.Lit_Other '^'> <side-7>} {<-->} {<file-1>})
    (C {<check>} {<side-1>} {<Id.Lit_Other '^'> <side-7>} {<-->} {<file-2>})
    (C {<check>} {<side-3>} {<Id.Lit_Other '^'> <side-4>} {<-->} {<file-3>})
    (C {<check>} {<side-3>} {<Id.Lit_Other '^'> <side-2>})
    (C {<check>} {<side-3>} {<Id.Lit_Other '^'> <side-2>} {<-->} {<file-1>})
    (C {<test_expect_success>} {(SQ <'not only --stdin'>)} 
      {
        (SQ <'\n'> <'\tcat >expect <<-EOF &&\n'> <'\t7\n'> <'\n'> <'\tfile-1\n'> <'\tfile-2\n'> <'\tEOF\n'> 
          <'\tcat >input <<-EOF &&\n'> <'\t^master^\n'> <'\t--\n'> <'\tfile-2\n'> <'\tEOF\n'> 
          <'\tgit log --pretty=tformat:%s --name-only --stdin master -- file-1 \\\n'> <'\t\t<input >actual &&\n'> <'\ttest_cmp expect actual\n'>
        )
      }
    )
    (C {<test_done>})
  ]
)