(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:stdoutF 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] ) (/STDOUT) ) } spids: [46] ) ] spids: [46] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:stderrF 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] ) (/STDERR) ) } spids: [57] ) ] spids: [57] ) (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)) spids: [338 341] ) ) } ) (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'>)}) ] spids: [81] ) spids: [77 80] ) (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 spids:[572]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [572] ) ] spids: [572] ) (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)) spids: [591 594] ) ) } ) (C {(assertTrue)} { (DQ ("DEFINE_boolean() call with default of '") (${ VSub_Name default) ("' returned failure.") ) } {(${ VSub_Name rtrn)} ) ] spids: [549 617] ) spids: [537 547] ) (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 spids:[665]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [665] ) ] spids: [665] ) (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)) spids: [684 687] ) ) } ) (C {(assertTrue)} { (DQ ("DEFINE_boolean() call with default of '") (${ VSub_Name default) ("' returned failure.") ) } {(${ VSub_Name rtrn)} ) ] spids: [642 710] ) spids: [630 640] ) (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)}) ] spids: [525] ) spids: [521 524] ) (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 spids:[812]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [812] ) ] spids: [812] ) (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)) spids: [831 834] ) ) } ) (C {(assertTrue)} { (DQ ("DEFINE_float() call with valid default of '") (${ VSub_Name default) ("' returned failure.") ) } {(${ VSub_Name rtrn)} ) ] spids: [786 857] ) spids: [780 784] ) (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)}) ] spids: [768] ) spids: [764 767] ) (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 spids:[961]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [961] ) ] spids: [961] ) (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)) spids: [982 985] ) ) } ) (C {(assertTrue)} { (DQ ("DEFINE_integer() call with valid default of '") (${ VSub_Name default) ("' returned failure.") ) } {(${ VSub_Name rtrn)} ) ] spids: [935 1008] ) spids: [929 933] ) (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'>)}) ] spids: [917] ) spids: [913 916] ) (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 spids:[1248]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [1248] ) ] spids: [1248] ) (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)) spids: [1269 1272] ) ) } ) (C {(assertTrue)} { (DQ ("DEFINE_string() call with valid default of '") (${ VSub_Name default) ("' returned failure.") ) } {(${ VSub_Name rtrn)} ) ] spids: [1222 1295] ) spids: [1196 16777215] ) (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 spids:[1320]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [1320] ) ] spids: [1320] ) (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)) spids: [1338 1341] ) ) } ) ] spids: [1184] ) spids: [1180 1183] ) (command.FuncDef name: testShortNameLength body: (command.BraceGroup children:[(C {(Lit_Other ':')})] spids:[1351]) spids: [1347 1350] ) (command.FuncDef name: testFlagNameIsReserved body: (command.BraceGroup children: [ (command.Subshell child: (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))} ) ] ) spids: [1370 1401] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:rtrn spids:[1404]) op: Equal rhs: {($ VSub_QMark '$?')} spids: [1404] ) ] spids: [1404] ) (C {(assertEquals)} {(DQ (${ VSub_Name FLAGS_ERROR))} {(DQ (${ VSub_Name rtrn))}) (C {(assertErrorMsg)} {(SQ <'flag name (TRUE) is reserved'>)}) ] spids: [1367] ) spids: [1363 1366] ) (command.FuncDef name: oneTimeSetUp body: (command.BraceGroup children:[(C {(th_oneTimeSetUp)})] spids:[1436]) spids: [1432 1435] ) (command.FuncDef name: tearDown body: (command.BraceGroup children:[(C {(flags_reset)})] spids:[1448]) spids: [1444 1447] ) (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: [1467 1470] ) ) } {(Lit_Other ']')} ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:SHUNIT_PARENT spids:[1477]) op: Equal rhs: {($ VSub_Number '$0')} spids: [1477] ) ] spids: [1477] ) ] ) (C {(.)} {(DQ (${ VSub_Name TH_SHUNIT))}) ] )