(CommandList
  children: [
    (C {(cd)} 
      {
        (BracedVarSub
          token: <VSub_Number 0>
          suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(Lit_Slash /) ("*")})
          spids: [6 11]
        )
      }
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:tmp)
          op: Equal
          rhs: 
            {
              (BracedVarSub
                token: <VSub_Name TEMP>
                suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(Lit_Slash /) (tmp)})
                spids: [14 19]
              )
            }
          spids: [13]
        )
      ]
      spids: [13]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:tmp)
          op: Equal
          rhs: 
            {
              (BracedVarSub
                token: <VSub_Name tmp>
                suffix_op: (StringUnary op_id:VOp1_DPercent arg_word:{(Lit_Slash /)})
                spids: [22 26]
              ) (/)
            }
          spids: [21]
        )
      ]
      spids: [21]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:fails) op:Equal rhs:{(0)} spids:[33])]
      spids: [33]
    )
    (Assignment
      keyword: Assign_None
      pairs: [(assign_pair lhs:(LhsName name:i) op:Equal rhs:{(0)} spids:[36])]
      spids: [36]
    )
    (Assignment
      keyword: Assign_None
      pairs: [
        (assign_pair
          lhs: (LhsName name:tests)
          op: Equal
          rhs: 
            {
              (CommandSubPart
                command_list: 
                  (CommandList
                    children: [
                      (Pipeline
                        children: [(C {(ls)} {(valid/) (Lit_Other "*") (.json)}) (C {(wc)} {(-l)})]
                        negated: False
                      )
                    ]
                  )
                left_token: <Left_Backtick "`">
                spids: [40 52]
              )
            }
          spids: [39]
        )
      ]
      spids: [39]
    )
    (C {(echo)} {(DQ (1..) ($ VSub_Name "$tests"))})
    (ForEach
      iter_name: input
      iter_words: [{(valid/) (Lit_Other "*") (.json)}]
      do_arg_iter: False
      body: 
        (DoGroup
          children: [
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:input_file)
                  op: Equal
                  rhs: 
                    {
                      (BracedVarSub
                        token: <VSub_Name input>
                        suffix_op: (StringUnary op_id:VOp1_DPound arg_word:{("*") (Lit_Slash /)})
                        spids: [75 80]
                      )
                    }
                  spids: [74]
                )
              ]
              spids: [74]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:expected)
                  op: Equal
                  rhs: 
                    {
                      (DQ (${ VSub_Name tmp) 
                        (BracedVarSub
                          token: <VSub_Name input_file>
                          suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(.json)})
                          spids: [88 92]
                        ) (.no-head)
                      )
                    }
                  spids: [83]
                )
              ]
              spids: [83]
            )
            (SimpleCommand
              words: [{(egrep)} {(-v)} {(SQ <"^\\[]">)}]
              redirects: [
                (Redir
                  op_id: Redir_Less
                  fd: -1
                  arg_word: 
                    {
                      (BracedVarSub
                        token: <VSub_Name input>
                        suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(.json)})
                        spids: [107 111]
                      ) (.parsed)
                    }
                  spids: [105]
                )
                (Redir
                  op_id: Redir_Great
                  fd: -1
                  arg_word: {($ VSub_Name "$expected")}
                  spids: [114]
                )
              ]
            )
            (Assignment
              keyword: Assign_None
              pairs: [
                (assign_pair
                  lhs: (LhsName name:i)
                  op: Equal
                  rhs: 
                    {
                      (ArithSubPart
                        anode: 
                          (ArithBinary
                            op_id: Arith_Plus
                            left: (ArithVarRef name:i)
                            right: (ArithWord w:{(Lit_Digits 1)})
                          )
                        spids: [120 125]
                      )
                    }
                  spids: [119]
                )
              ]
              spids: [119]
            )
            (If
              arms: [
                (if_arm
                  cond: [
                    (Pipeline
                      children: [
                        (SimpleCommand
                          words: [{(../JSON.sh)} {(-n)}]
                          redirects: [
                            (Redir
                              op_id: Redir_Less
                              fd: -1
                              arg_word: {(DQ ($ VSub_Name "$input"))}
                              spids: [136]
                            )
                          ]
                        )
                        (C {(diff)} {(-u)} {(-)} {(DQ ($ VSub_Name "$expected"))})
                      ]
                      negated: True
                    )
                  ]
                  action: [
                    (C {(echo)} {(DQ ("not ok ") ($ VSub_Name "$i") (" - ") ($ VSub_Name "$input"))})
                    (Assignment
                      keyword: Assign_None
                      pairs: [
                        (assign_pair
                          lhs: (LhsName name:fails)
                          op: Equal
                          rhs: 
                            {
                              (ArithSubPart
                                anode: 
                                  (ArithBinary
                                    op_id: Arith_Plus
                                    left: (ArithVarRef name:fails)
                                    right: (ArithWord w:{(Lit_Digits 1)})
                                  )
                                spids: [170 175]
                              )
                            }
                          spids: [169]
                        )
                      ]
                      spids: [169]
                    )
                  ]
                  spids: [-1 156]
                )
              ]
              else_action: [
                (C {(echo)} {(DQ ("ok ") ($ VSub_Name "$i") (" - ") ($ VSub_Name "$input"))})
              ]
              spids: [178 192]
            )
          ]
          spids: [71 194]
        )
      spids: [66 -1]
    )
    (C {(echo)} {(DQ ($ VSub_Name "$fails") (" test(s) failed"))})
    (C {(exit)} {($ VSub_Name "$fails")})
  ]
)