(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 <'a call for help should return a non-zero 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: testStandardHelpOutput body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DPipe] children: [(C {(flags_getoptIsStd)}) (C {(startSkipping)})] ) (C {(DEFINE_boolean)} {(test_bool)} {(false)} {(SQ <'test boolean'>)} {(b)}) (C {(DEFINE_integer)} {(test_int)} {(0)} {(SQ <'test integer'>)} {(i)}) (C {(DEFINE_string)} {(test_str)} {(SQ )} {(SQ <'test string'>)} {(s)}) (C {(DEFINE_string)} {(long_desc)} {(SQ <blah>)} {(SQ <'testing of a long description to force wrap of default value'>)} {(D)} ) (C {(DEFINE_string)} {(long_default)} {(SQ <this_is_a_long_default_value_to_force_alternate_indentation>)} {(SQ <'testing of long default value'>)} {(F)} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:help spids:[560]) op: Equal rhs: {(SQ <'USAGE: standard [flags] args'>)} spids: [560] ) ] spids: [560] ) (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: 593 stdin_parts: [ (${ VSub_Name help) ('\n') ('flags:\n') (' -b test boolean (default: false)\n') (' -i test integer (default: 0)\n') (" -s test string (default: '')\n") (' -D testing of a long description to force wrap of default value\n') (" (default: 'blah')\n") (' -F testing of long default value\n') ( " (default: 'this_is_a_long_default_value_to_force_alternate_indentation')\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: [602] ) spids: [598 601] ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:FLAGS_HELP spids:[610]) op: Equal rhs: {(${ VSub_Name help)} spids: [610] ) ] spids: [610] ) 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: [{(echo)} {($ VSub_QMark '$?')}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name returnF))} ) ] ) ] ) spids: [595 648] ) (C {(assertFalse)} {(SQ <'a call for help should return a non-zero exit code.'>)} { (DQ (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(th_queryReturn)})]) left_token: <Left_CommandSub '$('> spids: [662 664] ) ) } ) (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:[687]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [687] ) ] spids: [687] ) (C {(assertTrue)} {(SQ <'unexpected help output'>)} {(${ VSub_Name r3turn)}) (C {(th_showOutput)} {(${ VSub_Name r3turn)} {(DQ (${ VSub_Name stdoutF))} {(DQ (${ VSub_Name stderrF))} ) ] spids: [473] ) spids: [469 472] ) (command.FuncDef name: testEnhancedHelpOutput body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DPipe] children: [(C {(flags_getoptIsEnh)}) (C {(startSkipping)})] ) (C {(DEFINE_boolean)} {(test_bool)} {(false)} {(SQ <'test boolean'>)} {(b)}) (C {(DEFINE_integer)} {(test_int)} {(0)} {(SQ <'test integer'>)} {(i)}) (C {(DEFINE_string)} {(test_str)} {(SQ )} {(SQ <'test string'>)} {(s)}) (C {(DEFINE_string)} {(long_desc)} {(SQ <blah>)} {(SQ <'testing of a long description to force wrap of default value'>)} {(D)} ) (C {(DEFINE_string)} {(long_default)} {(SQ <this_is_a_long_default_value_to_force_alternate_indentation>)} {(SQ <'testing of long default value'>)} {(F)} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:help spids:[814]) op: Equal rhs: {(SQ <'USAGE: enhanced [flags] args'>)} spids: [814] ) ] spids: [814] ) (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: 847 stdin_parts: [ (${ VSub_Name help) ('\n') ('flags:\n') (' -b,--[no]test_bool: test boolean (default: false)\n') (' -i,--test_int: test integer (default: 0)\n') (" -s,--test_str: test string (default: '')\n") ( ' -D,--long_desc: testing of a long description to force wrap of default value\n' ) (" (default: 'blah')\n") (' -F,--long_default: testing of long default value\n') ( " (default: 'this_is_a_long_default_value_to_force_alternate_indentation')\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: [856] ) spids: [852 855] ) (command.Sentence child: (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:FLAGS_HELP spids:[868]) op: Equal rhs: {(${ VSub_Name help)} spids: [868] ) ] spids: [868] ) 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: [{(echo)} {($ VSub_QMark '$?')}] redirects: [ (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ (${ VSub_Name returnF))} ) ] ) ] ) spids: [849 906] ) (C {(assertFalse)} {(SQ <'a call for help should return a non-zero exit code.'>)} { (DQ (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(th_queryReturn)})]) left_token: <Left_CommandSub '$('> spids: [920 922] ) ) } ) (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:[945]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [945] ) ] spids: [945] ) (C {(assertTrue)} {(SQ <'unexpected help output'>)} {(${ VSub_Name differed)}) (C {(th_showOutput)} {(${ VSub_Name differed)} {(DQ (${ VSub_Name stdoutF))} {(DQ (${ VSub_Name stderrF))} ) ] spids: [727] ) spids: [723 726] ) (command.FuncDef name: testNoHelp body: (command.BraceGroup children: [ (command.AndOr ops: [Op_DPipe] children: [(C {(flags_getoptIsEnh)}) (C {(startSkipping)})] ) (command.Subshell child: (command.SimpleCommand words: [{(FLAGS)} {(--nohelp)}] 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: [996 1016] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:r3turn spids:[1019]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [1019] ) ] spids: [1019] ) (C {(assertTrue)} {(DQ ('FLAGS returned a non-zero result (') (${ VSub_Name r3turn) (')'))} {(${ VSub_Name r3turn)} ) (C {(assertFalse)} {(SQ <'expected no output to STDOUT'>)} {(DQ ("[ -s '") (${ VSub_Name stdoutF) ("' ]"))} ) (C {(assertFalse)} {(SQ <'expected no output to STDERR'>)} {(DQ ("[ -s '") (${ VSub_Name stderrF) ("' ]"))} ) ] spids: [985] ) spids: [981 984] ) (command.FuncDef name: testLoggingLevel body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:got spids:[1081]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(flags_loggingLevel)})]) left_token: <Left_CommandSub '$('> spids: [1082 1084] ) } spids: [1081] ) (assign_pair lhs: (lhs_expr.LhsName name:want spids:[1086]) op: Equal rhs: {(${ VSub_Name __FLAGS_LEVEL_DEFAULT)} spids: [1086] ) ] spids: [1081] ) (C {(assertTrue)} { (DQ ('Unexpected default logging level = ') (${ VSub_Name got) (', want ') (${ VSub_Name want) ) } {(DQ ('[ ') (${ VSub_Name got) (' -eq ') (${ VSub_Name want) (' ]'))} ) (C {(flags_setLoggingLevel)} {(DQ (${ VSub_Name FLAGS_LEVEL_FATAL))}) (C {(flags_setLoggingLevel)} {(DQ (${ VSub_Name FLAGS_LEVEL_INFO))}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:got spids:[1141]) op: Equal rhs: { (word_part.CommandSubPart command_list: (command.CommandList children:[(C {(flags_loggingLevel)})]) left_token: <Left_CommandSub '$('> spids: [1142 1144] ) } spids: [1141] ) (assign_pair lhs: (lhs_expr.LhsName name:want spids:[1146]) op: Equal rhs: {(${ VSub_Name FLAGS_LEVEL_INFO)} spids: [1146] ) ] spids: [1141] ) (C {(assertTrue)} { (DQ ('Unexpected configured logging level = ') (${ VSub_Name got) (', want ') (${ VSub_Name want) ) } {(DQ ('[ ') (${ VSub_Name got) (' -eq ') (${ VSub_Name want) (' ]'))} ) ] spids: [1074] ) spids: [1070 1073] ) (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 1196] ) ] spids: [16777215 1209] ) (C {(th_warn)} {(SQ <'Enhanced version of getopt found. Standard tests will be skipped.'>)}) ] spids: [1184] ) spids: [1180 1183] ) (command.FuncDef name: setUp body: (command.BraceGroup children:[(C {(flags_reset)})] spids:[1225]) spids: [1221 1224] ) (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: [1244 1247] ) ) } {(Lit_Other ']')} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:SHUNIT_PARENT spids:[1254]) op: Equal rhs: {($ VSub_Number '$0')} spids: [1254] ) ] spids: [1254] ) ] ) (C {(.)} {(DQ (${ VSub_Name TH_SHUNIT))}) ] )