(command.CommandList
  children: [
    (command.ShFunction
      name: test_terminal
      body: 
        (command.BraceGroup
          children: [
            (command.If
              arms: [
                (if_arm
                  cond: [(command.Pipeline children:[(C {(test_declared_prereq)} {(TTY)})] negated:T)]
                  action: [
                    (command.Simple
                      words: [{(echo)} {(DQ ('test_terminal: need to declare TTY prerequisite'))}]
                      redirects: [
                        (redir.Redir
                          op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:35)
                          fd: -1
                          arg_word: {(4)}
                        )
                      ]
                    )
                    (command.ControlFlow
                      token: (Token id:Id.ControlFlow_Return val:return span_id:43)
                      arg_word: {(127)}
                    )
                  ]
                  spids: [21 30]
                )
              ]
            )
            (C {(perl)} {(DQ ($ Id.VSub_DollarName '$TEST_DIRECTORY')) (/test-terminal.perl)} 
              {(DQ ($ Id.VSub_At '$@'))}
            )
          ]
        )
    )
    (C {(test_lazy_prereq)} {(TTY)} 
      {
        (SQ (Token id:Id.Lit_Chars val:'\n' span_id:70) 
          (Token id:Id.Lit_Chars val:'\ttest_have_prereq PERL &&\n' span_id:71) (Token id:Id.Lit_Chars val:'\n' span_id:72) 
          (Token
            id: Id.Lit_Chars
            val: '\t# Reading from the pty master seems to get stuck _sometimes_\n'
            span_id: 73
          ) (Token id:Id.Lit_Chars val:'\t# on Mac OS X 10.5.0, using Perl 5.10.0 or 5.8.9.\n' span_id:74) 
          (Token id:Id.Lit_Chars val:'\t#\n' span_id:75) (Token id:Id.Lit_Chars val:'\t# Reproduction recipe: run\n' span_id:76) 
          (Token id:Id.Lit_Chars val:'\t#\n' span_id:77) (Token id:Id.Lit_Chars val:'\t#\ti=0\n' span_id:78) 
          (Token
            id: Id.Lit_Chars
            val: '\t#\twhile ./test-terminal.perl echo hi $i\n'
            span_id: 79
          ) (Token id:Id.Lit_Chars val:'\t#\tdo\n' span_id:80) 
          (Token id:Id.Lit_Chars val:'\t#\t\t: $((i = $i + 1))\n' span_id:81) (Token id:Id.Lit_Chars val:'\t#\tdone\n' span_id:82) (Token id:Id.Lit_Chars val:'\t#\n' span_id:83) 
          (Token
            id: Id.Lit_Chars
            val: '\t# After 2000 iterations or so it hangs.\n'
            span_id: 84
          ) (Token id:Id.Lit_Chars val:'\t# https://rt.cpan.org/Ticket/Display.html?id=65692\n' span_id:85) 
          (Token id:Id.Lit_Chars val:'\t#\n' span_id:86) (Token id:Id.Lit_Chars val:'\ttest "$(uname -s)" != Darwin &&\n' span_id:87) 
          (Token id:Id.Lit_Chars val:'\n' span_id:88) (Token id:Id.Lit_Chars val:'\tperl "$TEST_DIRECTORY"/test-terminal.perl \\\n' span_id:89) 
          (Token id:Id.Lit_Chars val:'\t\tsh -c "test -t 1 && test -t 2"\n' span_id:90)
        )
      }
    )
  ]
)