(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:stdoutF) 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)} ) ) (/STDOUT) ) } ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:stderrF) 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)} ) ) (/STDERR) ) } ) ] ) (C {(.)} {(./shflags_test_helpers)}) (command.FuncDef name: testFlagsDefine body: (command.BraceGroup children: [ (command.SimpleCommand words: [{(_flags_define)}] 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))} ) ] ) (C {(assertFalse)} {(SQ <'_flags_define() with no arguments should have failed.'>)} {($ VSub_QMark '$?')} ) (C {(assertErrorMsg)} {(SQ )} {(SQ <'no arguments'>)}) (command.SimpleCommand words: [{(_flags_define)} {(arg1)}] 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))} ) ] ) (C {(assertFalse)} {(SQ <'_flags_define() call with one argument should fail'>)} {($ VSub_QMark '$?')} ) (C {(assertErrorMsg)} {(SQ )} {(SQ <'one argument'>)}) (command.SimpleCommand words: [{(_flags_define)} {(arg1)} {(arg2)}] 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))} ) ] ) (C {(assertFalse)} {(SQ <'_flags_define() call with two arguments should fail'>)} {($ VSub_QMark '$?')} ) (C {(assertErrorMsg)} {(SQ )} {(SQ <'two arguments'>)}) (command.SimpleCommand words: [{(_flags_define)} {(arg1)} {(arg2)} {(arg3)}] 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))} ) ] ) (C {(assertFalse)} {(SQ <'_flags_define() call with three arguments should fail'>)} {($ VSub_QMark '$?')} ) (C {(assertErrorMsg)} {(SQ )} {(SQ <'three arguments'>)}) (C {(_flags_define)} {(DQ (${ VSub_Name __FLAGS_TYPE_BOOLEAN))} {(multiDefBool)} {(true)} {(SQ <'multi def #1'>)} {(m)} ) (command.SimpleCommand words: [ {(_flags_define)} {(DQ (${ VSub_Name __FLAGS_TYPE_BOOLEAN))} {(multiDefBool)} {(false)} {(SQ <'multi def #2'>)} {(m)} ] 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))} ) ] ) (C {(assertFalse)} {(SQ <'_flags_define() with existing flag name should fail'>)} {($ VSub_QMark '$?')} ) (C {(assertTrue)} {(SQ <'_flags_define() should not overwrite previously defined default.'>)} { (DQ (word_part.BracedVarSub token: <VSub_Name FLAGS_multiDefBool> suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:(word.EmptyWord)) ) ) } ) (C {(assertWarnMsg)} {(SQ )} {(SQ <'existing flag'>)}) (C {(_flags_define)} {(DQ (${ VSub_Name __FLAGS_TYPE_STRING))} {(long-name)} {(SQ <foo>)} {(SQ <'dashed name'>)} {(l)} ) (command.SimpleCommand words: [ {(_flags_define)} {(DQ (${ VSub_Name __FLAGS_TYPE_STRING))} {(long_name)} {(SQ <bar>)} {(SQ <'underscored name'>)} {(l)} ] 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))} ) ] ) (C {(assertFalse)} {(SQ <'_flags_define() with existing flag name should fail'>)} {($ VSub_QMark '$?')} ) (C {(assertEquals)} {(SQ <'_flags_define() should not overwrite previously defined default.'>)} {(DQ (${ VSub_Name FLAGS_long_name))} {(SQ <foo>)} ) (C {(assertWarnMsg)} {(SQ )} {(SQ <'already exists'>)}) (command.SimpleCommand words: [{(_flags_define)} {(invalid)} {(arg2)} {(arg3)} {(arg4)} {(i)}] 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))} ) ] ) (C {(assertFalse)} {(SQ <'_flags_define() with "invalid" type should have failed.'>)} {($ VSub_QMark '$?')} ) (C {(assertErrorMsg)} {(SQ <'unrecognized flag type'>)} {(SQ <'invalid type'>)}) ] ) ) (command.FuncDef name: testBoolean body: (command.BraceGroup children: [ (command.ForEach iter_name: default iter_words: [{(SQ <true>)} {(SQ <t>)} {(0)}] do_arg_iter: F body: (command.DoGroup children: [ (C {(flags_reset)}) (C {(DEFINE_boolean)} {(boolVal)} {(DQ (${ VSub_Name default))} {(SQ <'my boolean'>)} {(b)} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:rtrn) op: Equal rhs: {($ VSub_QMark '$?')} ) ] ) (C {(assertTrue)} { (DQ ("DEFINE_boolean() call with default of '") (${ VSub_Name default) ("' failed.") ) } { (DQ (word_part.BracedVarSub token: <VSub_Name FLAGS_boolVal> suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:(word.EmptyWord)) ) ) } ) (C {(assertTrue)} { (DQ ("DEFINE_boolean() call with default of '") (${ VSub_Name default) ("' returned failure.") ) } {(${ VSub_Name rtrn)} ) ] ) ) (command.ForEach iter_name: default iter_words: [{(SQ <false>)} {(SQ <f>)} {(1)}] do_arg_iter: F body: (command.DoGroup children: [ (C {(flags_reset)}) (C {(DEFINE_boolean)} {(boolVal)} {(DQ (${ VSub_Name default))} {(SQ <'my boolean'>)} {(b)} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:rtrn) op: Equal rhs: {($ VSub_QMark '$?')} ) ] ) (C {(assertFalse)} { (DQ ("DEFINE_boolean() call with default of '") (${ VSub_Name default) ("' failed.") ) } { (DQ (word_part.BracedVarSub token: <VSub_Name FLAGS_boolVal> suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:(word.EmptyWord)) ) ) } ) (C {(assertTrue)} { (DQ ("DEFINE_boolean() call with default of '") (${ VSub_Name default) ("' returned failure.") ) } {(${ VSub_Name rtrn)} ) ] ) ) (C {(flags_reset)}) (command.SimpleCommand words: [{(DEFINE_boolean)} {(boolVal)} {(SQ <invalid>)} {(SQ <'my boolean'>)} {(b)}] 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))} ) ] ) (C {(assertFalse)} {(SQ <'DEFINE_boolean() call with invalid default did not fail.'>)} {($ VSub_QMark '$?')} ) (C {(assertErrorMsg)}) ] ) ) (command.FuncDef name: testFloat body: (command.BraceGroup children: [ (command.ForEach iter_name: default iter_words: [{(${ VSub_Name TH_FLOAT_VALID)}] do_arg_iter: F body: (command.DoGroup children: [ (C {(flags_reset)}) (C {(DEFINE_float)} {(floatVal)} {(DQ (${ VSub_Name default))} {(DQ ('float: ') (${ VSub_Name default))} {(f)} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:rtrn) op: Equal rhs: {($ VSub_QMark '$?')} ) ] ) (C {(assertSame)} {(DQ ('DEFINE_float() call with valid default failed.'))} {(DQ (${ VSub_Name default))} { (DQ (word_part.BracedVarSub token: <VSub_Name FLAGS_floatVal> suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:(word.EmptyWord)) ) ) } ) (C {(assertTrue)} { (DQ ("DEFINE_float() call with valid default of '") (${ VSub_Name default) ("' returned failure.") ) } {(${ VSub_Name rtrn)} ) ] ) ) (C {(flags_reset)}) (command.SimpleCommand words: [ {(DEFINE_float)} {(floatVal)} {(SQ <invalid>)} {(SQ <'invalid float: string'>)} {(f)} ] 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))} ) ] ) (C {(assertFalse)} {(SQ <'DEFINE_float() call with string value default did not fail.'>)} {($ VSub_QMark '$?')} ) (C {(assertErrorMsg)}) ] ) ) (command.FuncDef name: testInteger body: (command.BraceGroup children: [ (command.ForEach iter_name: default iter_words: [{(${ VSub_Name TH_INT_VALID)}] do_arg_iter: F body: (command.DoGroup children: [ (C {(flags_reset)}) (C {(DEFINE_integer)} {(intVal)} {(DQ (${ VSub_Name default))} {(DQ ('integer: ') (${ VSub_Name default))} {(i)} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:rtrn) op: Equal rhs: {($ VSub_QMark '$?')} ) ] ) (C {(assertSame)} {(DQ ('DEFINE_integer() call with valid default failed.'))} {(DQ (${ VSub_Name default))} { (DQ (word_part.BracedVarSub token: <VSub_Name FLAGS_intVal> suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:(word.EmptyWord)) ) ) } ) (C {(assertTrue)} { (DQ ("DEFINE_integer() call with valid default of '") (${ VSub_Name default) ("' returned failure.") ) } {(${ VSub_Name rtrn)} ) ] ) ) (C {(flags_reset)}) (command.SimpleCommand words: [{(DEFINE_integer)} {(intVal)} {(1.234)} {(SQ <'invalid integer: float'>)} {(i)}] 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))} ) ] ) (C {(assertFalse)} {(SQ <'DEFINE_integer() call with float value default did not fail.'>)} {($ VSub_QMark '$?')} ) (C {(assertErrorMsg)} {(SQ <'invalid default'>)} {(SQ <'float default'>)}) (command.SimpleCommand words: [ {(DEFINE_integer)} {(intVal)} {(-1.234)} {(SQ <'invalid integer: negative float'>)} {(i)} ] 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))} ) ] ) (C {(assertFalse)} {(SQ <'DEFINE_integer() call with negative float value default did not fail.'>)} {($ VSub_QMark '$?')} ) (C {(assertErrorMsg)} {(SQ <'invalid default'>)} {(SQ <'negative float default'>)}) (command.SimpleCommand words: [ {(DEFINE_integer)} {(intVal)} {(SQ <invalid>)} {(SQ <'invalid integer: string'>)} {(i)} ] 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))} ) ] ) (C {(assertFalse)} {(SQ <'DEFINE_integer() call with string value default did not fail.'>)} {($ VSub_QMark '$?')} ) (C {(assertErrorMsg)} {(SQ <'invalid default'>)} {(SQ <'string default'>)}) ] ) ) (command.FuncDef name: testString body: (command.BraceGroup children: [ (command.ForEach iter_name: default iter_words: [ {(${ VSub_Name TH_BOOL_VALID)} {(${ VSub_Name TH_FLOAT_VALID)} {(${ VSub_Name TH_INT_VALID)} {(SQ <'also valid'>)} ] do_arg_iter: F body: (command.DoGroup children: [ (C {(flags_reset)}) (C {(DEFINE_string)} {(strVal)} {(DQ (${ VSub_Name default))} {(DQ ('string: ') (${ VSub_Name default))} {(s)} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:rtrn) op: Equal rhs: {($ VSub_QMark '$?')} ) ] ) (C {(assertSame)} {(DQ ('DEFINE_string() call with valid default failed.'))} {(DQ (${ VSub_Name default))} { (DQ (word_part.BracedVarSub token: <VSub_Name FLAGS_strVal> suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:(word.EmptyWord)) ) ) } ) (C {(assertTrue)} { (DQ ("DEFINE_string() call with valid default of '") (${ VSub_Name default) ("' returned failure.") ) } {(${ VSub_Name rtrn)} ) ] ) ) (C {(flags_reset)}) (C {(DEFINE_string)} {(str)} {(SQ )} {(DQ ('string: empty single quotes'))} {(s)}) (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:rtrn) op:Equal rhs:{($ VSub_QMark '$?')})] ) (C {(assertSame)} {(DQ ('DEFINE_string() call with valid default failed.'))} {(SQ )} { (DQ (word_part.BracedVarSub token: <VSub_Name FLAGS_str> suffix_op: (suffix_op.StringUnary op_id:VTest_ColonHyphen arg_word:(word.EmptyWord)) ) ) } ) ] ) ) (command.FuncDef name: testShortNameLength body: (command.BraceGroup children:[(C {(Lit_Other ':')})]) ) (command.FuncDef name: testFlagNameIsReserved body: (command.BraceGroup children: [ (command.Subshell command_list: (command.CommandList children: [ (command.SimpleCommand words: [ {(DEFINE_string)} {(TRUE)} {(SQ )} {(SQ <'true is a reserved flag name'>)} {(t)} ] 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.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:rtrn) op:Equal rhs:{($ VSub_QMark '$?')})] ) (C {(assertEquals)} {(DQ (${ VSub_Name FLAGS_ERROR))} {(DQ (${ VSub_Name rtrn))}) (C {(assertErrorMsg)} {(SQ <'flag name (TRUE) is reserved'>)}) ] ) ) (command.FuncDef name: oneTimeSetUp body: (command.BraceGroup children:[(C {(th_oneTimeSetUp)})]) ) (command.FuncDef name:tearDown body:(command.BraceGroup children:[(C {(flags_reset)})])) (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)) ) ) } {(Lit_Other ']')} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:SHUNIT_PARENT) op: Equal rhs: {($ VSub_Number '$0')} ) ] ) ] ) (C {(.)} {(DQ (${ VSub_Name TH_SHUNIT))}) ] )