(command.CommandList
  children: [
    (C {<cd>} 
      {
        (braced_var_sub
          token: <Id.VSub_Number 0>
          suffix_op: 
            (suffix_op.Unary
              tok: <Id.VOp1_Percent '%'>
              arg_word: {<Id.Lit_Slash '/'> <Id.Lit_Other '*'>}
            )
        )
      }
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tmp)
          op: assign_op.Equal
          rhs: 
            {
              (braced_var_sub
                token: <Id.VSub_Name TEMP>
                suffix_op: 
                  (suffix_op.Unary
                    tok: <Id.VTest_ColonHyphen ':-'>
                    arg_word: {<Id.Lit_Slash '/'> <tmp>}
                  )
              )
            }
          spids: [13]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tmp)
          op: assign_op.Equal
          rhs: 
            {
              (braced_var_sub
                token: <Id.VSub_Name tmp>
                suffix_op: (suffix_op.Unary tok:<Id.VOp1_DPercent '%%'> arg_word:{<Id.Lit_Slash '/'>})
              ) <'/'>
            }
          spids: [21]
        )
      ]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:fails) op:assign_op.Equal rhs:{<0>} spids:[33])]
    )
    (command.ShAssignment
      pairs: [(assign_pair lhs:(sh_lhs_expr.Name name:i) op:assign_op.Equal rhs:{<0>} spids:[36])]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tests)
          op: assign_op.Equal
          rhs: 
            {
              (command_sub
                left_token: <Id.Left_Backtick '`'>
                child: 
                  (command.Pipeline
                    children: [(C {<ls>} {<'valid/'> <Id.Lit_Star '*'> <.json>}) (C {<wc>} {<-l>})]
                    negated: F
                  )
              )
            }
          spids: [39]
        )
      ]
    )
    (C {<echo>} {(DQ <1..> ($ Id.VSub_DollarName '$tests'))})
    (command.ForEach
      iter_name: input
      iter_words: [{<'valid/'> <Id.Lit_Star '*'> <.json>}]
      do_arg_iter: F
      body: 
        (command.DoGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:input_file)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Name input>
                        suffix_op: 
                          (suffix_op.Unary
                            tok: <Id.VOp1_DPound '##'>
                            arg_word: {<Id.Lit_Other '*'> <Id.Lit_Slash '/'>}
                          )
                      )
                    }
                  spids: [76]
                )
              ]
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:expected)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ (${ Id.VSub_Name tmp) 
                        (braced_var_sub
                          token: <Id.VSub_Name input_file>
                          suffix_op: (suffix_op.Unary tok:<Id.VOp1_Percent '%'> arg_word:{<.json>})
                        ) <.no-head>
                      )
                    }
                  spids: [85]
                )
              ]
            )
            (command.Simple
              words: [{<egrep>} {<-v>} {(SQ <'^\\[]'>)}]
              redirects: [
                (redir
                  op: <Id.Redir_Less '<'>
                  loc: (redir_loc.Fd fd:0)
                  arg: 
                    {
                      (braced_var_sub
                        token: <Id.VSub_Name input>
                        suffix_op: (suffix_op.Unary tok:<Id.VOp1_Percent '%'> arg_word:{<.json>})
                      ) <.parsed>
                    }
                )
                (redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {($ Id.VSub_DollarName '$expected')}
                )
              ]
              do_fork: T
            )
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:i)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (word_part.ArithSub
                        anode: 
                          (arith_expr.Binary
                            op_id: Id.Arith_Plus
                            left: <Id.Lit_ArithVarLike i>
                            right: {<Id.Lit_Digits 1>}
                          )
                      )
                    }
                  spids: [121]
                )
              ]
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Pipeline
                          children: [
                            (command.Simple
                              words: [{<'../JSON.sh'>} {<-n>}]
                              redirects: [
                                (redir
                                  op: <Id.Redir_Less '<'>
                                  loc: (redir_loc.Fd fd:0)
                                  arg: {(DQ ($ Id.VSub_DollarName '$input'))}
                                )
                              ]
                              do_fork: T
                            )
                            (C {<diff>} {<-u>} {<->} {(DQ ($ Id.VSub_DollarName '$expected'))})
                          ]
                          negated: T
                        )
                      ]
                    )
                  action: [
                    (C {<echo>} 
                      {
                        (DQ <'not ok '> ($ Id.VSub_DollarName '$i') <' - '> 
                          ($ Id.VSub_DollarName '$input')
                        )
                      }
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:fails)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (word_part.ArithSub
                                anode: 
                                  (arith_expr.Binary
                                    op_id: Id.Arith_Plus
                                    left: <Id.Lit_ArithVarLike fails>
                                    right: {<Id.Lit_Digits 1>}
                                  )
                              )
                            }
                          spids: [171]
                        )
                      ]
                    )
                  ]
                  spids: [130 158]
                )
              ]
              else_action: [
                (C {<echo>} 
                  {(DQ <'ok '> ($ Id.VSub_DollarName '$i') <' - '> ($ Id.VSub_DollarName '$input'))}
                )
              ]
            )
          ]
        )
    )
    (C {<echo>} {(DQ ($ Id.VSub_DollarName '$fails') <' test(s) failed'>)})
    (command.ControlFlow
      token: <Id.ControlFlow_Exit exit>
      arg_word: {($ Id.VSub_DollarName '$fails')}
    )
  ]
)