(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:test_description)
          op: assign_op.Equal
          rhs: {(SQ <'test various @{X} syntax combinations together'>)}
          spids: [4]
        )
      ]
    )
    (C {<.>} {<'./test-lib.sh'>})
    (command.ShFunction
      name: check
      body: 
        (BraceGroup
          children: [
            (C 
              {<test_expect_> 
                (braced_var_sub
                  token: <Id.VSub_Number 4>
                  suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:{<success>})
                )
              } {(DQ ($ Id.VSub_Number '$1') <' = '> ($ Id.VSub_Number '$3'))} 
              {
                (DQ <'\n'> <'\t\techo \''> ($ Id.VSub_Number '$3') <'\' >expect &&\n'> <'\t\tif test \''> 
                  ($ Id.VSub_Number '$2') <'\' = \'commit\'\n'> <'\t\tthen\n'> <'\t\t\tgit log -1 --format=%s \''> ($ Id.VSub_Number '$1') 
                  <'\' >actual\n'> <'\t\telif test \''> ($ Id.VSub_Number '$2') <'\' = \'ref\'\n'> <'\t\tthen\n'> 
                  <'\t\t\tgit rev-parse --symbolic-full-name \''> ($ Id.VSub_Number '$1') <'\' >actual\n'> <'\t\telse\n'> <'\t\t\tgit cat-file -p \''> 
                  ($ Id.VSub_Number '$1') <'\' >actual\n'> <'\t\tfi &&\n'> <'\t\ttest_cmp expect actual\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: nonsense
      body: 
        (BraceGroup
          children: [
            (C 
              {<test_expect_> 
                (braced_var_sub
                  token: <Id.VSub_Number 2>
                  suffix_op: (suffix_op.Unary tok:<Id.VTest_ColonHyphen ':-'> arg_word:{<success>})
                )
              } {(DQ ($ Id.VSub_Number '$1') <' is nonsensical'>)} 
              {
                (DQ <'\n'> <'\t\ttest_must_fail git rev-parse --verify \''> ($ Id.VSub_Number '$1') 
                  <'\'\n'> <'\t'>
                )
              }
            )
          ]
        )
    )
    (command.ShFunction
      name: fail
      body: (BraceGroup children:[(C {(DQ ($ Id.VSub_At '$@'))} {<failure>})])
    )
    (C {<test_expect_success>} {(SQ <setup>)} 
      {
        (SQ <'\n'> <'\ttest_commit master-one &&\n'> <'\ttest_commit master-two &&\n'> 
          <'\tgit checkout -b upstream-branch &&\n'> <'\ttest_commit upstream-one &&\n'> <'\ttest_commit upstream-two &&\n'> 
          <'\tif test_have_prereq !MINGW\n'> <'\tthen\n'> <'\t\tgit checkout -b @/at-test\n'> <'\tfi &&\n'> <'\tgit checkout -b @@/at-test &&\n'> 
          <'\tgit checkout -b @at-test &&\n'> <'\tgit checkout -b old-branch &&\n'> <'\ttest_commit old-one &&\n'> <'\ttest_commit old-two &&\n'> 
          <'\tgit checkout -b new-branch &&\n'> <'\ttest_commit new-one &&\n'> <'\ttest_commit new-two &&\n'> 
          <'\tgit branch -u master old-branch &&\n'> <'\tgit branch -u upstream-branch new-branch\n'>
        )
      }
    )
    (C {<check>} {<HEAD>} {<ref>} {<'refs/heads/new-branch'>})
    (C {<check>} {(DQ <'@{1}'>)} {<commit>} {<new-one>})
    (C {<check>} {(DQ <'HEAD@{1}'>)} {<commit>} {<new-one>})
    (C {<check>} {(DQ <'@{now}'>)} {<commit>} {<new-two>})
    (C {<check>} {(DQ <'HEAD@{now}'>)} {<commit>} {<new-two>})
    (C {<check>} {(DQ <'@{-1}'>)} {<ref>} {<'refs/heads/old-branch'>})
    (C {<check>} {(DQ <'@{-1}@{0}'>)} {<commit>} {<old-two>})
    (C {<check>} {(DQ <'@{-1}@{1}'>)} {<commit>} {<old-one>})
    (C {<check>} {(DQ <'@{u}'>)} {<ref>} {<'refs/heads/upstream-branch'>})
    (C {<check>} {(DQ <'HEAD@{u}'>)} {<ref>} {<'refs/heads/upstream-branch'>})
    (C {<check>} {(DQ <'@{u}@{1}'>)} {<commit>} {<upstream-one>})
    (C {<check>} {(DQ <'@{-1}@{u}'>)} {<ref>} {<'refs/heads/master'>})
    (C {<check>} {(DQ <'@{-1}@{u}@{1}'>)} {<commit>} {<master-one>})
    (C {<check>} {(DQ <'@'>)} {<commit>} {<new-two>})
    (C {<check>} {(DQ <'@@{u}'>)} {<ref>} {<'refs/heads/upstream-branch'>})
    (C {<check>} {(DQ <'@@/at-test'>)} {<ref>} 
      {<'refs/heads/'> <Id.Lit_At '@'> <Id.Lit_At '@'> <'/at-test'>}
    )
    (command.AndOr
      ops: [Id.Op_DPipe]
      children: [
        (C {<test_have_prereq>} {<MINGW>})
        (C {<check>} {(DQ <'@/at-test'>)} {<ref>} {<'refs/heads/'> <Id.Lit_At '@'> <'/at-test'>})
      ]
    )
    (C {<check>} {(DQ <'@at-test'>)} {<ref>} {<'refs/heads/'> <Id.Lit_Splice '@at'> <-test>})
    (C {<nonsense>} {(DQ <'@{u}@{-1}'>)})
    (C {<nonsense>} {(DQ <'@{0}@{0}'>)})
    (C {<nonsense>} {(DQ <'@{1}@{u}'>)})
    (C {<nonsense>} {(DQ <'HEAD@{-1}'>)})
    (C {<nonsense>} {(DQ <'@{-1}@{-1}'>)})
    (C {<check>} {(DQ <'HEAD@{3}'>)} {<commit>} {<old-two>})
    (C {<nonsense>} {(DQ <'@{3}'>)})
    (C {<test_expect_success>} {(SQ <'switch to old-branch'>)} 
      {(SQ <'\n'> <'\tgit checkout old-branch\n'>)}
    )
    (C {<check>} {<HEAD>} {<ref>} {<'refs/heads/old-branch'>})
    (C {<check>} {(DQ <'HEAD@{1}'>)} {<commit>} {<new-two>})
    (C {<check>} {(DQ <'@{1}'>)} {<commit>} {<old-one>})
    (C {<test_expect_success>} {(SQ <'create path with @'>)} 
      {
        (SQ <'\n'> <'\techo content >normal &&\n'> <'\techo content >fun@ny &&\n'> 
          <'\tgit add normal fun@ny &&\n'> <'\tgit commit -m "funny path"\n'>
        )
      }
    )
    (C {<check>} {(DQ <'@:normal'>)} {<blob>} {<content>})
    (C {<check>} {(DQ <'@:fun@ny'>)} {<blob>} {<content>})
    (C {<test_done>})
  ]
)