(command.CommandList
  children: [
    (C {<Id.KW_Set set>} {<-e>})
    (command.ShFunction
      name: encode_name
      body: 
        (command.BraceGroup
          children: [
            (C {<local>} {<Id.Lit_VarLike 'name='> (DQ ($ Id.VSub_Number '$1'))})
            (C {<local>} {<Id.Lit_VarLike 'result='> (DQ <test_>)})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.LogicalNot
                              child: 
                                (bool_expr.Binary
                                  op_id: Id.BoolBinary_EqualTilde
                                  left: {(DQ ($ Id.VSub_DollarName '$name'))}
                                  right: 
                                    {<Id.Lit_Other '['> <Id.Lit_Other '^'> <Id.Lit_Other '['> 
                                      <Id.Lit_Other ':'> <alnum> <Id.Lit_Other ':'> <Id.Lit_Other ']'> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\ '>) 
                                      <_-> <Id.Lit_Other ']'>
                                    }
                                )
                            )
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:name)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: <Id.VSub_Name name>
                                  suffix_op: 
                                    (suffix_op.PatSub
                                      pat: {<_>}
                                      replace: {<-5f>}
                                      replace_mode: Id.Lit_Slash
                                    )
                                )
                              )
                            }
                          spids: [61]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:name)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: <Id.VSub_Name name>
                                  suffix_op: 
                                    (suffix_op.PatSub
                                      pat: {<->}
                                      replace: {<-2d>}
                                      replace_mode: Id.Lit_Slash
                                    )
                                )
                              )
                            }
                          spids: [74]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:name)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: <Id.VSub_Name name>
                                  suffix_op: 
                                    (suffix_op.PatSub
                                      pat: {<' '>}
                                      replace: {<_>}
                                      replace_mode: Id.Lit_Slash
                                    )
                                )
                              )
                            }
                          spids: [87]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:result)
                          op: assign_op.PlusEqual
                          rhs: {(DQ ($ Id.VSub_DollarName '$name'))}
                          spids: [100]
                        )
                      ]
                    )
                  ]
                  spids: [32 58]
                )
              ]
              else_action: [
                (C {<local>} 
                  {<Id.Lit_VarLike 'length='> 
                    (DQ (braced_var_sub token:<Id.VSub_Name name> prefix_op:(Id.VSub_Pound)))
                  }
                )
                (C {<local>} {<char>} {<i>})
                (command.ForExpr
                  init: 
                    (arith_expr.BinaryAssign
                      op_id: Id.Arith_Equal
                      left: (sh_lhs_expr.Name name:i)
                      right: (arith_expr.ArithWord w:{<Id.Lit_Digits 0>})
                    )
                  cond: 
                    (arith_expr.Binary
                      op_id: Id.Arith_Less
                      left: (arith_expr.VarRef token:<Id.Lit_ArithVarLike i>)
                      right: (arith_expr.VarRef token:<Id.Lit_ArithVarLike length>)
                    )
                  update: 
                    (arith_expr.UnaryAssign
                      op_id: Id.Node_PostDPlus
                      child: (sh_lhs_expr.Name name:i)
                    )
                  body: 
                    (command.DoGroup
                      children: [
                        (command.ShAssignment
                          pairs: [
                            (assign_pair
                              lhs: (sh_lhs_expr.Name name:char)
                              op: assign_op.Equal
                              rhs: 
                                {
                                  (DQ 
                                    (braced_var_sub
                                      token: <Id.VSub_Name name>
                                      suffix_op: 
                                        (suffix_op.Slice
                                          begin: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$i')})
                                          length: (arith_expr.ArithWord w:{<Id.Lit_Digits 1>})
                                        )
                                    )
                                  )
                                }
                              spids: [150]
                            )
                          ]
                        )
                        (command.If
                          arms: [
                            (if_arm
                              cond: [
                                (command.Sentence
                                  child: 
                                    (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_DollarName '$char'))} 
                                      {<Id.Lit_Equals '='>} {(DQ <' '>)} {<Id.Lit_RBracket ']'>}
                                    )
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                              action: [
                                (command.ShAssignment
                                  pairs: [
                                    (assign_pair
                                      lhs: (sh_lhs_expr.Name name:result)
                                      op: assign_op.PlusEqual
                                      rhs: {(DQ <_>)}
                                      spids: [182]
                                    )
                                  ]
                                )
                              ]
                              spids: [162 179]
                            )
                            (if_arm
                              cond: [
                                (command.Sentence
                                  child: 
                                    (command.DBracket
                                      expr: 
                                        (bool_expr.Binary
                                          op_id: Id.BoolBinary_EqualTilde
                                          left: {(DQ ($ Id.VSub_DollarName '$char'))}
                                          right: 
                                            {<Id.Lit_Other '['> <Id.Lit_Other '['> <Id.Lit_Other ':'> 
                                              <alnum> <Id.Lit_Other ':'> <Id.Lit_Other ']'> <Id.Lit_Other ']'>
                                            }
                                        )
                                    )
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                              action: [
                                (command.ShAssignment
                                  pairs: [
                                    (assign_pair
                                      lhs: (sh_lhs_expr.Name name:result)
                                      op: assign_op.PlusEqual
                                      rhs: {(DQ ($ Id.VSub_DollarName '$char'))}
                                      spids: [212]
                                    )
                                  ]
                                )
                              ]
                              spids: [188 209]
                            )
                          ]
                          else_action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:result)
                                  op: assign_op.PlusEqual
                                  rhs: 
                                    {
                                      (DQ 
                                        (command_sub
                                          left_token: <Id.Left_DollarParen '$('>
                                          command_list: 
                                            (command.CommandList
                                              children: [
                                                (C {<printf>} {<-->} {(DQ <'-%02x'>)} 
                                                  {
                                                    (word_part.EscapedLiteral
                                                      token: <Id.Lit_EscapedChar "\\'">
                                                    ) (DQ ($ Id.VSub_DollarName '$char'))
                                                  }
                                                )
                                              ]
                                            )
                                        )
                                      )
                                    }
                                  spids: [221]
                                )
                              ]
                            )
                          ]
                        )
                      ]
                    )
                )
              ]
            )
            (C {<echo>} {(DQ ($ Id.VSub_DollarName '$result'))})
          ]
        )
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tests)
          op: assign_op.Equal
          rhs: {(sh_array_literal left:<Id.Op_LParen _>)}
          spids: [259]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:index)
          op: assign_op.Equal
          rhs: {<0>}
          spids: [263]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:pattern)
          op: assign_op.Equal
          rhs: {(SQ <'^ *@test  *([^ ].*)  *\\{ *(.*)$'>)}
          spids: [266]
        )
      ]
    )
    (command.WhileUntil
      keyword: <Id.KW_While while>
      cond: [
        (command.Sentence
          child: 
            (command.Simple
              words: [{<read>} {<-r>} {<line>}]
              more_env: [(env_pair name:IFS val:(word.Empty) spids:[274])]
            )
          terminator: <Id.Op_Semi _>
        )
      ]
      body: 
        (command.DoGroup
          children: [
            (C {<let>} {<Id.Lit_VarLike 'index+='> <1>})
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (command.DBracket
                          expr: 
                            (bool_expr.Binary
                              op_id: Id.BoolBinary_EqualTilde
                              left: {(DQ ($ Id.VSub_DollarName '$line'))}
                              right: {($ Id.VSub_DollarName '$pattern')}
                            )
                        )
                      terminator: <Id.Op_Semi _>
                    )
                  ]
                  action: [
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:quoted_name)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: <Id.VSub_Name BASH_REMATCH>
                                  bracket_op: 
                                    (bracket_op.ArrayIndex
                                      expr: (arith_expr.ArithWord w:{<Id.Lit_Digits 1>})
                                    )
                                )
                              )
                            }
                          spids: [310]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:body)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (braced_var_sub
                                  token: <Id.VSub_Name BASH_REMATCH>
                                  bracket_op: 
                                    (bracket_op.ArrayIndex
                                      expr: (arith_expr.ArithWord w:{<Id.Lit_Digits 2>})
                                    )
                                )
                              )
                            }
                          spids: [321]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:name)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (command_sub
                                  left_token: <Id.Left_DollarParen '$('>
                                  command_list: 
                                    (command.CommandList
                                      children: [
                                        (C {<eval>} {<echo>} {(DQ ($ Id.VSub_DollarName '$quoted_name'))})
                                      ]
                                    )
                                )
                              )
                            }
                          spids: [332]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:encoded_name)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (command_sub
                                  left_token: <Id.Left_DollarParen '$('>
                                  command_list: 
                                    (command.CommandList
                                      children: [
                                        (C {<encode_name>} {(DQ ($ Id.VSub_DollarName '$name'))})
                                      ]
                                    )
                                )
                              )
                            }
                          spids: [346]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: 
                            (sh_lhs_expr.IndexedName
                              name: tests
                              index: 
                                (arith_expr.ArithWord
                                  w: 
                                    {
                                      (DQ 
                                        (braced_var_sub
                                          token: <Id.VSub_Name tests>
                                          prefix_op: (Id.VSub_Pound)
                                          bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                                        )
                                      )
                                    }
                                )
                            )
                          op: assign_op.Equal
                          rhs: {(DQ ($ Id.VSub_DollarName '$encoded_name'))}
                          spids: [358]
                        )
                      ]
                    )
                    (C {<echo>} 
                      {
                        (DQ (${ Id.VSub_Name encoded_name) <'() { bats_test_begin '> 
                          (${ Id.VSub_Name quoted_name) <' '> (${ Id.VSub_Name index) <'; '> (${ Id.VSub_Name body)
                        )
                      }
                    )
                  ]
                  spids: [292 307]
                )
              ]
              else_action: [
                (C {<printf>} {(DQ <'%s'> <Id.Lit_Other '\\'> <n>)} {(DQ ($ Id.VSub_DollarName '$line'))})
              ]
            )
          ]
        )
    )
    (command.ForEach
      iter_name: test_name
      iter_words: [
        {
          (DQ 
            (braced_var_sub
              token: <Id.VSub_Name tests>
              bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
            )
          )
        }
      ]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [(C {<echo>} {(DQ <'bats_test_function '> (${ Id.VSub_Name test_name))})]
        )
    )
  ]
)