(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 children: [(C {(flags_getoptIsEnh)}) (ControlFlow token:<ControlFlow_Return return>)] op_id: Op_DPipe ) (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: -1 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: -1 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:-1 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 children: [ (C {(Lit_Other '[')} {(${ VSub_Name grepped)} {(-ne)} {(DQ (${ VSub_Name FLAGS_TRUE))} {(Lit_Other ']')} ) (C {(th_showOutput)}) ] op_id: Op_DAmp ) (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: -1 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:-1 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 children: [ (C {(Lit_Other '[')} {(${ VSub_Name grepped)} {(-ne)} {(DQ (${ VSub_Name FLAGS_TRUE))} {(Lit_Other ']')} ) (C {(th_showOutput)}) ] op_id: Op_DAmp ) (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: -1 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:-1 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 children: [ (C {(Lit_Other '[')} {(${ VSub_Name grepped)} {(-ne)} {(DQ (${ VSub_Name FLAGS_TRUE))} {(Lit_Other ']')} ) (C {(th_showOutput)}) ] op_id: Op_DAmp ) ] 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 children: [(C {(flags_getoptIsStd)}) (C {(startSkipping)})] op_id: Op_DPipe ) (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: -1 arg_word: {(DQ (${ VSub_Name expectedF))} spids: [569] ) (HereDoc op_id: Redir_DLess fd: -1 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: True spids: [576] ) ] ) (Subshell child: (CommandList children: [ (FuncDef name: _flags_columns body: (BraceGroup children: [ (Sentence child: (C {(mock_flags_columns)}) terminator: <Op_Semi ';'> ) ] spids: [600] ) spids: [596 599] ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:FLAGS_HELP) op: Equal rhs: {(${ VSub_Name help)} spids: [608] ) ] spids: [608] ) terminator: <Op_Semi ';'> ) (SimpleCommand words: [{(FLAGS)} {(-h)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name stdoutF))} spids: [619] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} spids: [626] ) ] ) (SimpleCommand words: [{(echo)} {($ VSub_QMark '$?')}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name returnF))} spids: [638] ) ] ) ] ) spids: [593 646] ) (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: [660 662] ) ) } ) (SimpleCommand words: [{(diff)} {(DQ (${ VSub_Name expectedF))} {(DQ (${ VSub_Name stderrF))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[681])] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:r3turn) op: Equal rhs: {($ VSub_QMark '$?')} spids: [685] ) ] spids: [685] ) (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 children: [(C {(flags_getoptIsEnh)}) (C {(startSkipping)})] op_id: Op_DPipe ) (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: [812] ) ] spids: [812] ) (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name expectedF))} spids: [821] ) (HereDoc op_id: Redir_DLess fd: -1 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: True spids: [828] ) ] ) (Subshell child: (CommandList children: [ (FuncDef name: _flags_columns body: (BraceGroup children: [ (Sentence child: (C {(mock_flags_columns)}) terminator: <Op_Semi ';'> ) ] spids: [852] ) spids: [848 851] ) (Sentence child: (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:FLAGS_HELP) op: Equal rhs: {(${ VSub_Name help)} spids: [864] ) ] spids: [864] ) terminator: <Op_Semi ';'> ) (SimpleCommand words: [{(FLAGS)} {(-h)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name stdoutF))} spids: [875] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} spids: [882] ) ] ) (SimpleCommand words: [{(echo)} {($ VSub_QMark '$?')}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name returnF))} spids: [894] ) ] ) ] ) spids: [845 902] ) (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: [916 918] ) ) } ) (SimpleCommand words: [{(diff)} {(DQ (${ VSub_Name expectedF))} {(DQ (${ VSub_Name stderrF))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(/dev/null)} spids:[937])] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:differed) op: Equal rhs: {($ VSub_QMark '$?')} spids: [941] ) ] spids: [941] ) (C {(assertTrue)} {(SQ <'unexpected help output'>)} {(${ VSub_Name differed)}) (C {(th_showOutput)} {(${ VSub_Name differed)} {(DQ (${ VSub_Name stdoutF))} {(DQ (${ VSub_Name stderrF))} ) ] spids: [725] ) spids: [721 724] ) (FuncDef name: testNoHelp body: (BraceGroup children: [ (AndOr children: [(C {(flags_getoptIsEnh)}) (C {(startSkipping)})] op_id: Op_DPipe ) (Subshell child: (SimpleCommand words: [{(FLAGS)} {(--nohelp)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name stdoutF))} spids: [998] ) (Redir op_id: Redir_Great fd: 2 arg_word: {(DQ (${ VSub_Name stderrF))} spids: [1005] ) ] ) spids: [992 1012] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:r3turn) op: Equal rhs: {($ VSub_QMark '$?')} spids: [1015] ) ] spids: [1015] ) (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: [981] ) spids: [977 980] ) (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: [1078 1080] ) } spids: [1077] ) (assign_pair lhs: (LhsName name:want) op: Equal rhs: {(${ VSub_Name __FLAGS_LEVEL_DEFAULT)} spids: [1082] ) ] spids: [1077] ) (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: [1138 1140] ) } spids: [1137] ) (assign_pair lhs: (LhsName name:want) op: Equal rhs: {(${ VSub_Name FLAGS_LEVEL_INFO)} spids: [1142] ) ] spids: [1137] ) (C {(assertTrue)} { (DQ ('Unexpected configured logging level = ') (${ VSub_Name got) (', want ') (${ VSub_Name want) ) } {(DQ ('[ ') (${ VSub_Name got) (' -eq ') (${ VSub_Name want) (' ]'))} ) ] spids: [1070] ) spids: [1066 1069] ) (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: [-1 1192] ) ] spids: [-1 1205] ) (C {(th_warn)} {(SQ <'Enhanced version of getopt found. Standard tests will be skipped.'>)}) ] spids: [1180] ) spids: [1176 1179] ) (FuncDef name: setUp body: (BraceGroup children:[(C {(flags_reset)})] spids:[1221]) spids: [1217 1220] ) (AndOr children: [ (C {(Lit_Other '[')} {(-n)} { (DQ (BracedVarSub token: <VSub_Name ZSH_VERSION> suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{(SQ )}) spids: [1240 1243] ) ) } {(Lit_Other ']')} ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:SHUNIT_PARENT) op: Equal rhs: {($ VSub_Number '$0')} spids: [1250] ) ] spids: [1250] ) ] op_id: Op_DAmp ) (C {(.)} {(DQ (${ VSub_Name TH_SHUNIT))}) ] )