(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:expectedF) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Name TMPDIR> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(Lit_Slash /) (tmp)}) spids: [48 53] ) (/expected) ) } spids: [46] ) ] spids: [46] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:returnF) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Name TMPDIR> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(Lit_Slash /) (tmp)}) spids: [59 64] ) (/return) ) } spids: [57] ) ] spids: [57] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:stdoutF) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Name TMPDIR> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(Lit_Slash /) (tmp)}) spids: [70 75] ) (/STDOUT) ) } spids: [68] ) ] spids: [68] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:stderrF) op: Equal rhs: { (DQ (BracedVarSub token: <VSub_Name TMPDIR> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(Lit_Slash /) (tmp)}) spids: [81 86] ) (/STDERR) ) } spids: [79] ) ] spids: [79] ) (C {(.)} {(./shflags_test_helpers)}) (FuncDef name: testHelp body: (BraceGroup children: [ (C {(_testHelp)} {(SQ <-h>)}) (AndOr ops: [Op_DPipe] children: [(C {(flags_getoptIsEnh)}) (ControlFlow token:<ControlFlow_Return return>)] ) (C {(_testHelp)} {(SQ <--help>)}) ] spids: [103] ) spids: [99 102] ) (FuncDef name: _testHelp body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:flag) op: Equal rhs: {($ VSub_Number '$1')} spids: [136] ) ] spids: [136] ) (C {(th_clearReturn)}) (Subshell child: (CommandList children: [ (SimpleCommand words: [{(FLAGS)} {(DQ (${ VSub_Name flag))}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (${ VSub_Name stdoutF))} spids: [159] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} spids: [166] ) ] ) (SimpleCommand words: [{(echo)} {($ VSub_QMark '$?')}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (${ VSub_Name returnF))} spids: [178] ) ] ) ] ) spids: [148 186] ) (C {(assertFalse)} {(SQ <'a call for help should return a non-zero exit code.'>)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(th_queryReturn)})]) left_token: <Left_CommandSub '$('> spids: [200 202] ) ) } ) (SimpleCommand words: [{(grep)} {(SQ <'show this help'>)} {(DQ (${ VSub_Name stderrF))}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(/dev/null)} spids:[218])] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:grepped) 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)} ) (AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(${ VSub_Name grepped)} {(-ne)} {(DQ (${ VSub_Name FLAGS_TRUE))} {(Lit_Other ']')} ) (C {(th_showOutput)}) ] ) (Subshell child: (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:FLAGS_HELP) op: Equal rhs: {(SQ <'this is a test'>)} spids: [270] ) ] spids: [270] ) (SimpleCommand words: [{(FLAGS)} {(DQ (${ VSub_Name flag))}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (${ VSub_Name stdoutF))} spids: [284] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} spids: [291] ) ] ) ] ) spids: [267 299] ) (SimpleCommand words: [{(grep)} {(SQ <'this is a test'>)} {(DQ (${ VSub_Name stderrF))}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(/dev/null)} spids:[314])] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:grepped) op: Equal rhs: {($ VSub_QMark '$?')} spids: [318] ) ] spids: [318] ) (C {(assertTrue)} {(SQ <'setting FLAGS_HELP did not produce expected result'>)} {(${ VSub_Name grepped)} ) (AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(${ VSub_Name grepped)} {(-ne)} {(DQ (${ VSub_Name FLAGS_TRUE))} {(Lit_Other ']')} ) (C {(th_showOutput)}) ] ) (Subshell child: (CommandList children: [ (C {(DEFINE_boolean)} {(b)} {(false)} {(DQ ("help string containing a ' char"))} {(b)}) (SimpleCommand words: [{(FLAGS)} {(DQ (${ VSub_Name flag))}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (${ VSub_Name stdoutF))} spids: [383] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} spids: [390] ) ] ) ] ) spids: [359 398] ) (SimpleCommand words: [{(grep)} {(DQ ("help string containing a ' char"))} {(DQ (${ VSub_Name stderrF))}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(/dev/null)} spids:[413])] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:grepped) op: Equal rhs: {($ VSub_QMark '$?')} spids: [417] ) ] spids: [417] ) (C {(assertTrue)} {(DQ ("help strings containing apostrophes don't work"))} {(${ VSub_Name grepped)} ) (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] ) (FuncDef name: mock_flags_columns body: (BraceGroup children:[(C {(echo)} {(80)})] spids:[459]) spids: [455 458] ) (FuncDef name: testStandardHelpOutput body: (BraceGroup children: [ (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)} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:help) op: Equal rhs: {(SQ <'USAGE: standard [flags] args'>)} spids: [560] ) ] spids: [560] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (${ VSub_Name expectedF))} spids: [569] ) (HereDoc op_id: Redir_DLess fd: 16777215 body: { (DQ (${ 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') ) } do_expansion: True here_end: EOF was_filled: T spids: [576] ) ] ) (Subshell child: (CommandList children: [ (FuncDef name: _flags_columns body: (BraceGroup children: [ (Sentence child: (C {(mock_flags_columns)}) terminator: <Op_Semi ';'> ) ] spids: [601] ) spids: [597 600] ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:FLAGS_HELP) op: Equal rhs: {(${ VSub_Name help)} spids: [609] ) ] spids: [609] ) terminator: <Op_Semi ';'> ) (SimpleCommand words: [{(FLAGS)} {(-h)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (${ VSub_Name stdoutF))} spids: [620] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} spids: [627] ) ] ) (SimpleCommand words: [{(echo)} {($ VSub_QMark '$?')}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (${ VSub_Name returnF))} spids: [639] ) ] ) ] ) spids: [594 647] ) (C {(assertFalse)} {(SQ <'a call for help should return a non-zero exit code.'>)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(th_queryReturn)})]) left_token: <Left_CommandSub '$('> spids: [661 663] ) ) } ) (SimpleCommand words: [{(diff)} {(DQ (${ VSub_Name expectedF))} {(DQ (${ VSub_Name stderrF))}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(/dev/null)} spids:[682])] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:r3turn) op: Equal rhs: {($ VSub_QMark '$?')} spids: [686] ) ] spids: [686] ) (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] ) (FuncDef name: testEnhancedHelpOutput body: (BraceGroup children: [ (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)} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:help) op: Equal rhs: {(SQ <'USAGE: enhanced [flags] args'>)} spids: [813] ) ] spids: [813] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (${ VSub_Name expectedF))} spids: [822] ) (HereDoc op_id: Redir_DLess fd: 16777215 body: { (DQ (${ 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') ) } do_expansion: True here_end: EOF was_filled: T spids: [829] ) ] ) (Subshell child: (CommandList children: [ (FuncDef name: _flags_columns body: (BraceGroup children: [ (Sentence child: (C {(mock_flags_columns)}) terminator: <Op_Semi ';'> ) ] spids: [854] ) spids: [850 853] ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:FLAGS_HELP) op: Equal rhs: {(${ VSub_Name help)} spids: [866] ) ] spids: [866] ) terminator: <Op_Semi ';'> ) (SimpleCommand words: [{(FLAGS)} {(-h)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (${ VSub_Name stdoutF))} spids: [877] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} spids: [884] ) ] ) (SimpleCommand words: [{(echo)} {($ VSub_QMark '$?')}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (${ VSub_Name returnF))} spids: [896] ) ] ) ] ) spids: [847 904] ) (C {(assertFalse)} {(SQ <'a call for help should return a non-zero exit code.'>)} { (DQ (CommandSubPart command_list: (CommandList children:[(C {(th_queryReturn)})]) left_token: <Left_CommandSub '$('> spids: [918 920] ) ) } ) (SimpleCommand words: [{(diff)} {(DQ (${ VSub_Name expectedF))} {(DQ (${ VSub_Name stderrF))}] redirects: [(Redir op_id:Redir_Great fd:16777215 arg_word:{(/dev/null)} spids:[939])] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:differed) op: Equal rhs: {($ VSub_QMark '$?')} spids: [943] ) ] spids: [943] ) (C {(assertTrue)} {(SQ <'unexpected help output'>)} {(${ VSub_Name differed)}) (C {(th_showOutput)} {(${ VSub_Name differed)} {(DQ (${ VSub_Name stdoutF))} {(DQ (${ VSub_Name stderrF))} ) ] spids: [726] ) spids: [722 725] ) (FuncDef name: testNoHelp body: (BraceGroup children: [ (AndOr ops: [Op_DPipe] children: [(C {(flags_getoptIsEnh)}) (C {(startSkipping)})] ) (Subshell child: (SimpleCommand words: [{(FLAGS)} {(--nohelp)}] redirects: [ (Redir op_id: Redir_Great fd: 16777215 arg_word: {(DQ (${ VSub_Name stdoutF))} spids: [1000] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} spids: [1007] ) ] ) spids: [994 1014] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:r3turn) op: Equal rhs: {($ VSub_QMark '$?')} spids: [1017] ) ] spids: [1017] ) (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: [983] ) spids: [979 982] ) (FuncDef name: testLoggingLevel body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:got) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(flags_loggingLevel)})]) left_token: <Left_CommandSub '$('> spids: [1080 1082] ) } spids: [1079] ) (assign_pair lhs: (LhsName name:want) op: Equal rhs: {(${ VSub_Name __FLAGS_LEVEL_DEFAULT)} spids: [1084] ) ] spids: [1079] ) (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))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:got) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(flags_loggingLevel)})]) left_token: <Left_CommandSub '$('> spids: [1140 1142] ) } spids: [1139] ) (assign_pair lhs: (LhsName name:want) op: Equal rhs: {(${ VSub_Name FLAGS_LEVEL_INFO)} spids: [1144] ) ] spids: [1139] ) (C {(assertTrue)} { (DQ ('Unexpected configured logging level = ') (${ VSub_Name got) (', want ') (${ VSub_Name want) ) } {(DQ ('[ ') (${ VSub_Name got) (' -eq ') (${ VSub_Name want) (' ]'))} ) ] spids: [1072] ) spids: [1068 1071] ) (FuncDef name: oneTimeSetUp body: (BraceGroup children: [ (C {(th_oneTimeSetUp)}) (If arms: [ (if_arm cond: [(Sentence child:(C {(flags_getoptIsStd)}) terminator:<Op_Semi ';'>)] action: [ (C {(th_warn)} {(SQ <'Standard version of getopt found. Enhanced tests will be skipped.'>)} ) (ControlFlow token:<ControlFlow_Return return>) ] spids: [16777215 1194] ) ] spids: [16777215 1207] ) (C {(th_warn)} {(SQ <'Enhanced version of getopt found. Standard tests will be skipped.'>)}) ] spids: [1182] ) spids: [1178 1181] ) (FuncDef name: setUp body: (BraceGroup children:[(C {(flags_reset)})] spids:[1223]) spids: [1219 1222] ) (AndOr ops: [Op_DAmp] children: [ (C {(Lit_Other '[')} {(-n)} { (DQ (BracedVarSub token: <VSub_Name ZSH_VERSION> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(EmptyPart)}) spids: [1242 1245] ) ) } {(Lit_Other ']')} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SHUNIT_PARENT) op: Equal rhs: {($ VSub_Number '$0')} spids: [1252] ) ] spids: [1252] ) ] ) (C {(.)} {(DQ (${ VSub_Name TH_SHUNIT))}) ] )