(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:expectedF) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: <Id.VSub_Name TMPDIR> suffix_op: (suffix_op.Unary op_id: Id.VTest_ColonHyphen arg_word: {<Id.Lit_Slash /> <tmp>} ) ) </expected> ) } spids: [46] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:returnF) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: <Id.VSub_Name TMPDIR> suffix_op: (suffix_op.Unary op_id: Id.VTest_ColonHyphen arg_word: {<Id.Lit_Slash /> <tmp>} ) ) </return> ) } spids: [57] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:stdoutF) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: <Id.VSub_Name TMPDIR> suffix_op: (suffix_op.Unary op_id: Id.VTest_ColonHyphen arg_word: {<Id.Lit_Slash /> <tmp>} ) ) </STDOUT> ) } spids: [68] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:stderrF) op: assign_op.Equal rhs: { (DQ (braced_var_sub token: <Id.VSub_Name TMPDIR> suffix_op: (suffix_op.Unary op_id: Id.VTest_ColonHyphen arg_word: {<Id.Lit_Slash /> <tmp>} ) ) </STDERR> ) } spids: [79] ) ] ) (C {<.>} {<./shflags_test_helpers>}) (command.ShFunction name: testHelp body: (command.BraceGroup children: [ (C {<_testHelp>} {(SQ <-h>)}) (command.AndOr ops: [Id.Op_DPipe] children: [ (C {<flags_getoptIsEnh>}) (command.ControlFlow token:<Id.ControlFlow_Return return>) ] ) (C {<_testHelp>} {(SQ <--help>)}) ] ) ) (command.ShFunction name: _testHelp body: (command.BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:flag) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [136] ) ] ) (C {<th_clearReturn>}) (command.Subshell command_list: (command.CommandList children: [ (command.Simple words: [{<FLAGS>} {(DQ (${ Id.VSub_Name flag))}] redirects: [ (redir.Redir op: <Id.Redir_Great '>'> fd: -1 arg_word: {(DQ (${ Id.VSub_Name stdoutF))} ) (redir.Redir op: <Id.Redir_Great '2>'> fd: 2 arg_word: {(DQ (${ Id.VSub_Name stderrF))} ) ] ) (command.Simple words: [{<echo>} {($ Id.VSub_QMark '$?')}] redirects: [ (redir.Redir op: <Id.Redir_Great '>'> fd: -1 arg_word: {(DQ (${ Id.VSub_Name returnF))} ) ] ) ] ) ) (C {<assertFalse>} {(SQ <'a call for help should return a non-zero exit code.'>)} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children:[(C {<th_queryReturn>})]) ) ) } ) (command.Simple words: [{<grep>} {(SQ <'show this help'>)} {(DQ (${ Id.VSub_Name stderrF))}] redirects: [(redir.Redir op:<Id.Redir_Great '>'> fd:-1 arg_word:{</dev/null>})] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:grepped) op: assign_op.Equal rhs: {($ Id.VSub_QMark '$?')} spids: [222] ) ] ) (C {<assertTrue>} {(SQ <'short request for help should have produced some help output.'>)} {(${ Id.VSub_Name grepped)} ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name grepped)} {<-ne>} {(DQ (${ Id.VSub_Name FLAGS_TRUE))} {<Id.Lit_RBracket ']'>} ) (C {<th_showOutput>}) ] ) (command.Subshell command_list: (command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FLAGS_HELP) op: assign_op.Equal rhs: {(SQ <'this is a test'>)} spids: [270] ) ] ) (command.Simple words: [{<FLAGS>} {(DQ (${ Id.VSub_Name flag))}] redirects: [ (redir.Redir op: <Id.Redir_Great '>'> fd: -1 arg_word: {(DQ (${ Id.VSub_Name stdoutF))} ) (redir.Redir op: <Id.Redir_Great '2>'> fd: 2 arg_word: {(DQ (${ Id.VSub_Name stderrF))} ) ] ) ] ) ) (command.Simple words: [{<grep>} {(SQ <'this is a test'>)} {(DQ (${ Id.VSub_Name stderrF))}] redirects: [(redir.Redir op:<Id.Redir_Great '>'> fd:-1 arg_word:{</dev/null>})] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:grepped) op: assign_op.Equal rhs: {($ Id.VSub_QMark '$?')} spids: [318] ) ] ) (C {<assertTrue>} {(SQ <'setting FLAGS_HELP did not produce expected result'>)} {(${ Id.VSub_Name grepped)} ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name grepped)} {<-ne>} {(DQ (${ Id.VSub_Name FLAGS_TRUE))} {<Id.Lit_RBracket ']'>} ) (C {<th_showOutput>}) ] ) (command.Subshell command_list: (command.CommandList children: [ (C {<DEFINE_boolean>} {<b>} {<false>} {(DQ <"help string containing a ' char">)} {<b>}) (command.Simple words: [{<FLAGS>} {(DQ (${ Id.VSub_Name flag))}] redirects: [ (redir.Redir op: <Id.Redir_Great '>'> fd: -1 arg_word: {(DQ (${ Id.VSub_Name stdoutF))} ) (redir.Redir op: <Id.Redir_Great '2>'> fd: 2 arg_word: {(DQ (${ Id.VSub_Name stderrF))} ) ] ) ] ) ) (command.Simple words: [ {<grep>} {(DQ <"help string containing a ' char">)} {(DQ (${ Id.VSub_Name stderrF))} ] redirects: [(redir.Redir op:<Id.Redir_Great '>'> fd:-1 arg_word:{</dev/null>})] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:grepped) op: assign_op.Equal rhs: {($ Id.VSub_QMark '$?')} spids: [417] ) ] ) (C {<assertTrue>} {(DQ <"help strings containing apostrophes don't work">)} {(${ Id.VSub_Name grepped)} ) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<Id.Lit_LBracket '['>} {(${ Id.VSub_Name grepped)} {<-ne>} {(DQ (${ Id.VSub_Name FLAGS_TRUE))} {<Id.Lit_RBracket ']'>} ) (C {<th_showOutput>}) ] ) ] ) ) (command.ShFunction name: mock_flags_columns body: (command.BraceGroup children:[(C {<echo>} {<80>})]) ) (command.ShFunction name: testStandardHelpOutput body: (command.BraceGroup children: [ (command.AndOr ops: [Id.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.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:help) op: assign_op.Equal rhs: {(SQ <'USAGE: standard [flags] args'>)} spids: [560] ) ] ) (command.Simple words: [{<cat>}] redirects: [ (redir.Redir op: <Id.Redir_Great '>'> fd: -1 arg_word: {(DQ (${ Id.VSub_Name expectedF))} ) (redir.HereDoc op: <Id.Redir_DLess '<<'> fd: -1 here_begin: {<EOF>} here_end_span_id: 593 stdin_parts: [ (${ Id.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 command_list: (command.CommandList children: [ (command.ShFunction name: _flags_columns body: (command.BraceGroup children: [ (command.Sentence child: (C {<mock_flags_columns>}) terminator: <Id.Op_Semi _> ) ] ) ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FLAGS_HELP) op: assign_op.Equal rhs: {(${ Id.VSub_Name help)} spids: [610] ) ] ) terminator: <Id.Op_Semi _> ) (command.Simple words: [{<FLAGS>} {<-h>}] redirects: [ (redir.Redir op: <Id.Redir_Great '>'> fd: -1 arg_word: {(DQ (${ Id.VSub_Name stdoutF))} ) (redir.Redir op: <Id.Redir_Great '2>'> fd: 2 arg_word: {(DQ (${ Id.VSub_Name stderrF))} ) ] ) (command.Simple words: [{<echo>} {($ Id.VSub_QMark '$?')}] redirects: [ (redir.Redir op: <Id.Redir_Great '>'> fd: -1 arg_word: {(DQ (${ Id.VSub_Name returnF))} ) ] ) ] ) ) (C {<assertFalse>} {(SQ <'a call for help should return a non-zero exit code.'>)} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children:[(C {<th_queryReturn>})]) ) ) } ) (command.Simple words: [{<diff>} {(DQ (${ Id.VSub_Name expectedF))} {(DQ (${ Id.VSub_Name stderrF))}] redirects: [(redir.Redir op:<Id.Redir_Great '>'> fd:-1 arg_word:{</dev/null>})] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r3turn) op: assign_op.Equal rhs: {($ Id.VSub_QMark '$?')} spids: [687] ) ] ) (C {<assertTrue>} {(SQ <'unexpected help output'>)} {(${ Id.VSub_Name r3turn)}) (C {<th_showOutput>} {(${ Id.VSub_Name r3turn)} {(DQ (${ Id.VSub_Name stdoutF))} {(DQ (${ Id.VSub_Name stderrF))} ) ] ) ) (command.ShFunction name: testEnhancedHelpOutput body: (command.BraceGroup children: [ (command.AndOr ops: [Id.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.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:help) op: assign_op.Equal rhs: {(SQ <'USAGE: enhanced [flags] args'>)} spids: [814] ) ] ) (command.Simple words: [{<cat>}] redirects: [ (redir.Redir op: <Id.Redir_Great '>'> fd: -1 arg_word: {(DQ (${ Id.VSub_Name expectedF))} ) (redir.HereDoc op: <Id.Redir_DLess '<<'> fd: -1 here_begin: {<EOF>} here_end_span_id: 847 stdin_parts: [ (${ Id.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 command_list: (command.CommandList children: [ (command.ShFunction name: _flags_columns body: (command.BraceGroup children: [ (command.Sentence child: (C {<mock_flags_columns>}) terminator: <Id.Op_Semi _> ) ] ) ) (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:FLAGS_HELP) op: assign_op.Equal rhs: {(${ Id.VSub_Name help)} spids: [868] ) ] ) terminator: <Id.Op_Semi _> ) (command.Simple words: [{<FLAGS>} {<-h>}] redirects: [ (redir.Redir op: <Id.Redir_Great '>'> fd: -1 arg_word: {(DQ (${ Id.VSub_Name stdoutF))} ) (redir.Redir op: <Id.Redir_Great '2>'> fd: 2 arg_word: {(DQ (${ Id.VSub_Name stderrF))} ) ] ) (command.Simple words: [{<echo>} {($ Id.VSub_QMark '$?')}] redirects: [ (redir.Redir op: <Id.Redir_Great '>'> fd: -1 arg_word: {(DQ (${ Id.VSub_Name returnF))} ) ] ) ] ) ) (C {<assertFalse>} {(SQ <'a call for help should return a non-zero exit code.'>)} { (DQ (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children:[(C {<th_queryReturn>})]) ) ) } ) (command.Simple words: [{<diff>} {(DQ (${ Id.VSub_Name expectedF))} {(DQ (${ Id.VSub_Name stderrF))}] redirects: [(redir.Redir op:<Id.Redir_Great '>'> fd:-1 arg_word:{</dev/null>})] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:differed) op: assign_op.Equal rhs: {($ Id.VSub_QMark '$?')} spids: [945] ) ] ) (C {<assertTrue>} {(SQ <'unexpected help output'>)} {(${ Id.VSub_Name differed)}) (C {<th_showOutput>} {(${ Id.VSub_Name differed)} {(DQ (${ Id.VSub_Name stdoutF))} {(DQ (${ Id.VSub_Name stderrF))} ) ] ) ) (command.ShFunction name: testNoHelp body: (command.BraceGroup children: [ (command.AndOr ops: [Id.Op_DPipe] children: [(C {<flags_getoptIsEnh>}) (C {<startSkipping>})] ) (command.Subshell command_list: (command.CommandList children: [ (command.Simple words: [{<FLAGS>} {<--nohelp>}] redirects: [ (redir.Redir op: <Id.Redir_Great '>'> fd: -1 arg_word: {(DQ (${ Id.VSub_Name stdoutF))} ) (redir.Redir op: <Id.Redir_Great '2>'> fd: 2 arg_word: {(DQ (${ Id.VSub_Name stderrF))} ) ] ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:r3turn) op: assign_op.Equal rhs: {($ Id.VSub_QMark '$?')} spids: [1019] ) ] ) (C {<assertTrue>} {(DQ <'FLAGS returned a non-zero result ('> (${ Id.VSub_Name r3turn) <')'>)} {(${ Id.VSub_Name r3turn)} ) (C {<assertFalse>} {(SQ <'expected no output to STDOUT'>)} {(DQ <"[ -s '"> (${ Id.VSub_Name stdoutF) <"' ]">)} ) (C {<assertFalse>} {(SQ <'expected no output to STDERR'>)} {(DQ <"[ -s '"> (${ Id.VSub_Name stderrF) <"' ]">)} ) ] ) ) (command.ShFunction name: testLoggingLevel body: (command.BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:got) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children:[(C {<flags_loggingLevel>})]) ) } spids: [1081] ) (assign_pair lhs: (sh_lhs_expr.Name name:want) op: assign_op.Equal rhs: {(${ Id.VSub_Name __FLAGS_LEVEL_DEFAULT)} spids: [1086] ) ] ) (C {<assertTrue>} { (DQ <'Unexpected default logging level = '> (${ Id.VSub_Name got) <', want '> (${ Id.VSub_Name want) ) } {(DQ <'[ '> (${ Id.VSub_Name got) <' -eq '> (${ Id.VSub_Name want) <' ]'>)} ) (C {<flags_setLoggingLevel>} {(DQ (${ Id.VSub_Name FLAGS_LEVEL_FATAL))}) (C {<flags_setLoggingLevel>} {(DQ (${ Id.VSub_Name FLAGS_LEVEL_INFO))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:got) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> command_list: (command.CommandList children:[(C {<flags_loggingLevel>})]) ) } spids: [1141] ) (assign_pair lhs: (sh_lhs_expr.Name name:want) op: assign_op.Equal rhs: {(${ Id.VSub_Name FLAGS_LEVEL_INFO)} spids: [1146] ) ] ) (C {<assertTrue>} { (DQ <'Unexpected configured logging level = '> (${ Id.VSub_Name got) <', want '> (${ Id.VSub_Name want) ) } {(DQ <'[ '> (${ Id.VSub_Name got) <' -eq '> (${ Id.VSub_Name want) <' ]'>)} ) ] ) ) (command.ShFunction name: oneTimeSetUp body: (command.BraceGroup children: [ (C {<th_oneTimeSetUp>}) (command.If arms: [ (if_arm cond: [(command.Sentence child:(C {<flags_getoptIsStd>}) terminator:<Id.Op_Semi _>)] action: [ (C {<th_warn>} {(SQ <'Standard version of getopt found. Enhanced tests will be skipped.'>)} ) (command.ControlFlow token:<Id.ControlFlow_Return return>) ] spids: [1191 1196] ) ] ) (C {<th_warn>} {(SQ <'Enhanced version of getopt found. Standard tests will be skipped.'>)}) ] ) ) (command.ShFunction name:setUp body:(command.BraceGroup children:[(C {<flags_reset>})])) (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<Id.Lit_LBracket '['>} {<-n>} { (DQ (braced_var_sub token: <Id.VSub_Name ZSH_VERSION> suffix_op: (suffix_op.Unary op_id:Id.VTest_ColonHyphen arg_word:(word.Empty)) ) ) } {<Id.Lit_RBracket ']'>} ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:SHUNIT_PARENT) op: assign_op.Equal rhs: {($ Id.VSub_Number '$0')} spids: [1254] ) ] ) ] ) (C {<.>} {(DQ (${ Id.VSub_Name TH_SHUNIT))}) ] )