(command.CommandList
  children: [
    (command.ShFunction
      name: test_terminal
      body: 
        (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 op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<4>})]
                      do_fork: T
                    )
                    (command.ControlFlow
                      token: <Id.ControlFlow_Return return>
                      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 <'\n'> <'\ttest_have_prereq PERL &&\n'> <'\n'> 
          <'\t# Reading from the pty master seems to get stuck _sometimes_\n'> <'\t# on Mac OS X 10.5.0, using Perl 5.10.0 or 5.8.9.\n'> <'\t#\n'> <'\t# Reproduction recipe: run\n'> 
          <'\t#\n'> <'\t#\ti=0\n'> <'\t#\twhile ./test-terminal.perl echo hi $i\n'> <'\t#\tdo\n'> 
          <'\t#\t\t: $((i = $i + 1))\n'> <'\t#\tdone\n'> <'\t#\n'> <'\t# After 2000 iterations or so it hangs.\n'> 
          <'\t# https://rt.cpan.org/Ticket/Display.html?id=65692\n'> <'\t#\n'> <'\ttest "$(uname -s)" != Darwin &&\n'> <'\n'> 
          <'\tperl "$TEST_DIRECTORY"/test-terminal.perl \\\n'> <'\t\tsh -c "test -t 1 && test -t 2"\n'>
        )
      }
    )
  ]
)