(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:expectedF spids:[46]) 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)} ) spids: [48 53] ) (/expected) ) } spids: [46] ) ] spids: [46] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:returnF spids:[57]) 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)} ) spids: [59 64] ) (/return) ) } spids: [57] ) ] spids: [57] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:stdoutF spids:[68]) 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)} ) spids: [70 75] ) (/STDOUT) ) } spids: [68] ) ] spids: [68] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:stderrF spids:[79]) 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)} ) spids: [81 86] ) (/STDERR) ) } spids: [79] ) ] spids: [79] ) (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>)}) ] spids: [103] ) spids: [99 102] ) (command.FuncDef name: _testHelp body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:flag spids:[136]) op: Equal rhs: {($ VSub_Number '$1')} spids: [136] ) ] spids: [136] ) (C {(th_clearReturn)}) (command.Subshell child: (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))} ) ] ) ] ) spids: [148 186] ) (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 '$('> spids: [200 202] ) ) } ) (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 spids:[222]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [222] ) ] spids: [222] ) (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 child: (command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:FLAGS_HELP spids:[270]) op: Equal rhs: {(SQ <'this is a test'>)} spids: [270] ) ] spids: [270] ) (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))} ) ] ) ] ) spids: [267 299] ) (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 spids:[318]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [318] ) ] spids: [318] ) (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 child: (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))} ) ] ) ] ) spids: [359 398] ) (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 spids:[417]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [417] ) ] spids: [417] ) (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)}) ] ) ] spids: [133] ) spids: [129 132] ) (command.FuncDef name: mock_flags_columns body: (command.BraceGroup children:[(C {(echo)} {(80)})] spids:[459]) spids: [455 458] ) (command.FuncDef name: _doDefines body: (command.BraceGroup children: [(C {(DEFINE_boolean)} {(SQ <force>)} {(false)} {(SQ )} {(f)})] spids: [473] ) spids: [469 472] ) (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 spids:[510]) op: Equal rhs: {(SQ <'USAGE: standard [flags] args'>)} spids: [510] ) ] spids: [510] ) (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 child: (command.CommandList children: [ (command.FuncDef name: _flags_columns body: (command.BraceGroup children: [ (command.Sentence child: (C {(mock_flags_columns)}) terminator: <Op_Semi ';'> ) ] spids: [546] ) spids: [542 545] ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:FLAGS_HELP spids:[554]) op: Equal rhs: {(${ VSub_Name help)} spids: [554] ) ] spids: [554] ) 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))} ) ] ) ] ) spids: [539 580] ) (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 spids:[601]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [601] ) ] spids: [601] ) (C {(assertTrue)} {(SQ <'unexpected help output'>)} {(${ VSub_Name r3turn)}) (C {(th_showOutput)} {(${ VSub_Name r3turn)} {(DQ (${ VSub_Name stdoutF))} {(DQ (${ VSub_Name stderrF))} ) ] spids: [496] ) spids: [492 495] ) (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 spids:[655]) op: Equal rhs: {(SQ <'USAGE: enhanced [flags] args'>)} spids: [655] ) ] spids: [655] ) (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 child: (command.CommandList children: [ (command.FuncDef name: _flags_columns body: (command.BraceGroup children: [ (command.Sentence child: (C {(mock_flags_columns)}) terminator: <Op_Semi ';'> ) ] spids: [691] ) spids: [687 690] ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:FLAGS_HELP spids:[703]) op: Equal rhs: {(${ VSub_Name help)} spids: [703] ) ] spids: [703] ) 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))} ) ] ) ] ) spids: [684 729] ) (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 spids:[750]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [750] ) ] spids: [750] ) (C {(assertTrue)} {(SQ <'unexpected help output'>)} {(${ VSub_Name differed)}) (C {(th_showOutput)} {(${ VSub_Name differed)} {(DQ (${ VSub_Name stdoutF))} {(DQ (${ VSub_Name stderrF))} ) ] spids: [641] ) spids: [637 640] ) (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>) ] spids: [16777215 802] ) ] spids: [16777215 815] ) (C {(th_warn)} {(SQ <'Enhanced version of getopt found. Standard tests will be skipped.'>)}) ] spids: [790] ) spids: [786 789] ) (command.FuncDef name: setUp body: (command.BraceGroup children:[(C {(flags_reset)})] spids:[831]) spids: [827 830] ) (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)) spids: [850 853] ) ) } {(Lit_Other ']')} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:SHUNIT_PARENT spids:[860]) op: Equal rhs: {($ VSub_Number '$0')} spids: [860] ) ] spids: [860] ) ] ) (C {(.)} {(DQ (${ VSub_Name TH_SHUNIT))}) ] )