(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:expectedF) op: Equal rhs: { (DQ (word_part.BracedVarSub token: <VSub_Name TMPDIR> suffix_op: (suffix_op.StringUnary op_id: VTest_ColonHyphen arg_word: {(Lit_Slash /) (tmp)} ) ) (/expected) ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:returnF) op: Equal rhs: { (DQ (word_part.BracedVarSub token: <VSub_Name TMPDIR> suffix_op: (suffix_op.StringUnary op_id: VTest_ColonHyphen arg_word: {(Lit_Slash /) (tmp)} ) ) (/return) ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:stdoutF) op: Equal rhs: { (DQ (word_part.BracedVarSub token: <VSub_Name TMPDIR> suffix_op: (suffix_op.StringUnary op_id: VTest_ColonHyphen arg_word: {(Lit_Slash /) (tmp)} ) ) (/STDOUT) ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:stderrF) op: Equal rhs: { (DQ (word_part.BracedVarSub token: <VSub_Name TMPDIR> suffix_op: (suffix_op.StringUnary op_id: VTest_ColonHyphen arg_word: {(Lit_Slash /) (tmp)} ) ) (/STDERR) ) } ) ] ) (C {(.)} {(./shflags_test_helpers)}) (command.FuncDef name: testHelp body: (command.BraceGroup children: [ (C {(_testHelp)} {(SQ <-h>)}) (command.AndOr ops: [Op_DPipe] children: [ (C {(flags_getoptIsEnh)}) (command.ControlFlow token:<ControlFlow_Return return>) ] ) (C {(_testHelp)} {(SQ <--help>)}) ] ) ) (command.FuncDef name: _testHelp body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:flag) op: Equal rhs: {($ VSub_Number '$1')} ) ] ) (C {(th_clearReturn)}) (command.Subshell command_list: (command.CommandList children: [ (command.SimpleCommand words: [{(FLAGS)} {(DQ (${ VSub_Name flag))}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name stdoutF))} ) (redir.Redir op: <Redir_Great '2>'> fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} ) ] ) (command.SimpleCommand words: [{(echo)} {($ VSub_QMark '$?')}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name returnF))} ) ] ) ] ) ) (C {(assertFalse)} {(SQ <'short help request should have returned a false exit code.'>)} { (DQ (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(th_queryReturn)})]) left_token: <Left_CommandSub '$('> ) ) } ) (command.SimpleCommand words: [{(grep)} {(SQ <'show this help'>)} {(DQ (${ VSub_Name stderrF))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:grepped) op: Equal rhs: {($ VSub_QMark '$?')} ) ] ) (C {(assertTrue)} {(SQ <'short request for help should have produced some help output.'>)} {(${ VSub_Name grepped)} ) (command.AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(${ VSub_Name grepped)} {(-ne)} {(DQ (${ VSub_Name FLAGS_TRUE))} {(Lit_Other ']')} ) (C {(th_showOutput)}) ] ) (command.Subshell command_list: (command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:FLAGS_HELP) op: Equal rhs: {(SQ <'this is a test'>)} ) ] ) (command.SimpleCommand words: [{(FLAGS)} {(DQ (${ VSub_Name flag))}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name stdoutF))} ) (redir.Redir op: <Redir_Great '2>'> fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} ) ] ) ] ) ) (command.SimpleCommand words: [{(grep)} {(SQ <'this is a test'>)} {(DQ (${ VSub_Name stderrF))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:grepped) op: Equal rhs: {($ VSub_QMark '$?')} ) ] ) (C {(assertTrue)} {(SQ <'setting FLAGS_HELP did not produce expected result'>)} {(${ VSub_Name grepped)} ) (command.AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(${ VSub_Name grepped)} {(-ne)} {(DQ (${ VSub_Name FLAGS_TRUE))} {(Lit_Other ']')} ) (C {(th_showOutput)}) ] ) (command.Subshell command_list: (command.CommandList children: [ (C {(DEFINE_boolean)} {(b)} {(false)} {(DQ ("help string containing a ' char"))} {(b)}) (command.SimpleCommand words: [{(FLAGS)} {(DQ (${ VSub_Name flag))}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name stdoutF))} ) (redir.Redir op: <Redir_Great '2>'> fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} ) ] ) ] ) ) (command.SimpleCommand words: [{(grep)} {(DQ ("help string containing a ' char"))} {(DQ (${ VSub_Name stderrF))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:grepped) op: Equal rhs: {($ VSub_QMark '$?')} ) ] ) (C {(assertTrue)} {(DQ ("help strings containing apostrophes don't work"))} {(${ VSub_Name grepped)} ) (command.AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(${ VSub_Name grepped)} {(-ne)} {(DQ (${ VSub_Name FLAGS_TRUE))} {(Lit_Other ']')} ) (C {(th_showOutput)}) ] ) ] ) ) (command.FuncDef name: mock_flags_columns body: (command.BraceGroup children:[(C {(echo)} {(80)})]) ) (command.FuncDef name: _doDefines body: (command.BraceGroup children: [(C {(DEFINE_boolean)} {(SQ <force>)} {(false)} {(SQ )} {(f)})] ) ) (command.FuncDef name: testStandardHelpOutput body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DPipe] children: [(C {(flags_getoptIsStd)}) (C {(startSkipping)})] ) (C {(_doDefines)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:help) op: Equal rhs: {(SQ <'USAGE: standard [flags] args'>)} ) ] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name expectedF))} ) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 537 stdin_parts: [ (${ VSub_Name help) ('\n') ('flags:\n') (' -f (default: false)\n') (' -h show this help (default: false)\n') ] ) ] ) (command.Subshell command_list: (command.CommandList children: [ (command.FuncDef name: _flags_columns body: (command.BraceGroup children: [ (command.Sentence child: (C {(mock_flags_columns)}) terminator: <Op_Semi ';'> ) ] ) ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:FLAGS_HELP) op: Equal rhs: {(${ VSub_Name help)} ) ] ) terminator: <Op_Semi ';'> ) (command.SimpleCommand words: [{(FLAGS)} {(-h)}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name stdoutF))} ) (redir.Redir op: <Redir_Great '2>'> fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} ) ] ) ] ) ) (command.SimpleCommand words: [{(diff)} {(DQ (${ VSub_Name expectedF))} {(DQ (${ VSub_Name stderrF))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:r3turn) op: Equal rhs: {($ VSub_QMark '$?')} ) ] ) (C {(assertTrue)} {(SQ <'unexpected help output'>)} {(${ VSub_Name r3turn)}) (C {(th_showOutput)} {(${ VSub_Name r3turn)} {(DQ (${ VSub_Name stdoutF))} {(DQ (${ VSub_Name stderrF))} ) ] ) ) (command.FuncDef name: testEnhancedHelpOutput body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DPipe] children: [(C {(flags_getoptIsEnh)}) (C {(startSkipping)})] ) (C {(_doDefines)}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:help) op: Equal rhs: {(SQ <'USAGE: enhanced [flags] args'>)} ) ] ) (command.SimpleCommand words: [{(cat)}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name expectedF))} ) (redir.HereDoc op: <Redir_DLess '<<'> fd: 16777215 here_begin: {(EOF)} here_end_span_id: 682 stdin_parts: [ (${ VSub_Name help) ('\n') ('flags:\n') (' -f,--[no]force: (default: false)\n') (' -h,--help: show this help (default: false)\n') ] ) ] ) (command.Subshell command_list: (command.CommandList children: [ (command.FuncDef name: _flags_columns body: (command.BraceGroup children: [ (command.Sentence child: (C {(mock_flags_columns)}) terminator: <Op_Semi ';'> ) ] ) ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:FLAGS_HELP) op: Equal rhs: {(${ VSub_Name help)} ) ] ) terminator: <Op_Semi ';'> ) (command.SimpleCommand words: [{(FLAGS)} {(-h)}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name stdoutF))} ) (redir.Redir op: <Redir_Great '2>'> fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} ) ] ) ] ) ) (command.SimpleCommand words: [{(diff)} {(DQ (${ VSub_Name expectedF))} {(DQ (${ VSub_Name stderrF))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:differed) op: Equal rhs: {($ VSub_QMark '$?')} ) ] ) (C {(assertTrue)} {(SQ <'unexpected help output'>)} {(${ VSub_Name differed)}) (C {(th_showOutput)} {(${ VSub_Name differed)} {(DQ (${ VSub_Name stdoutF))} {(DQ (${ VSub_Name stderrF))} ) ] ) ) (command.FuncDef name: oneTimeSetUp body: (command.BraceGroup children: [ (C {(th_oneTimeSetUp)}) (command.If arms: [ (if_arm cond: [(command.Sentence child:(C {(flags_getoptIsStd)}) terminator:<Op_Semi ';'>)] action: [ (C {(th_warn)} {(SQ <'Standard version of getopt found. Enhanced tests will be skipped.'>)} ) (command.ControlFlow token:<ControlFlow_Return return>) ] ) ] ) (C {(th_warn)} {(SQ <'Enhanced version of getopt found. Standard tests will be skipped.'>)}) ] ) ) (command.FuncDef name:setUp body:(command.BraceGroup children:[(C {(flags_reset)})])) (command.AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(-n)} { (DQ (word_part.BracedVarSub token: <VSub_Name ZSH_VERSION> suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:(word.EmptyWord)) ) ) } {(Lit_Other ']')} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:SHUNIT_PARENT) op: Equal rhs: {($ VSub_Number '$0')} ) ] ) ] ) (C {(.)} {(DQ (${ VSub_Name TH_SHUNIT))}) ] )