(command.CommandList children: [ (command.Simple blame_tok: <Id.Lit_Colon ':'> more_env: [] words: [ {<Id.Lit_Colon ':'>} { (BracedVarSub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Name TEST_SH> var_name: TEST_SH suffix_op: (suffix_op.Unary op:<Id.VTest_ColonEquals _> arg_word:{(DQ <'/bin/sh'>)}) right: <Id.Right_DollarBrace '}'> ) } ] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_test_case> more_env: [] words: [{<atf_test_case>} {<basic_shift_test>}] redirects: [] do_fork: T ) (command.ShFunction name_tok: <basic_shift_test_head> name: basic_shift_test_head body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_set> more_env: [] words: [{<atf_set>} {(DQ <descr>)} {(DQ <'Test correct operation of valid shifts'>)}] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <basic_shift_test_body> name: basic_shift_test_body body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ForEach keyword: <Id.KW_For for> iter_names: [a] iterable: (for_iter.Words words: [ {(DQ <'one-arg::0:one-arg'>)} {(DQ <'one-arg:1:0:one-arg'>)} {(DQ <'one-arg:0:1 one-arg'>)} {(DQ <'a b c::2 b c:a'>)} {(DQ <'a b c:1:2 b c:a'>)} {(DQ <'a b c:2:1 c:a:b'>)} {(DQ <'a b c:3:0:a:b:c'>)} {(DQ <'a b c:0:3 a b c'>)} {(DQ <'a b c d e f g h i j k l m n o p:1:15 b c d e f g h i j k l m n o p'>)} {(DQ <'a b c d e f g h i j k l m n o p:9:7 j k l m n o p:a:b:c:g:h:i'>)} {(DQ <'a b c d e f g h i j k l m n o p:13:3 n o p:a:b:c:d:k:l:m'>)} {(DQ <'a b c d e f g h i j k l m n o p:16:0:a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p'>)} ] ) body: (command.DoGroup left: <Id.KW_Do do> children: [ (command.ShAssignment left: <Id.Lit_VarLike 'oIFS='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'oIFS='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'oIFS='> name:oIFS) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name IFS))} ) ] redirects: [] ) (command.Sentence child: (command.ShAssignment left: <Id.Lit_VarLike 'IFS='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'IFS='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'IFS='> name:IFS) op: assign_op.Equal rhs: {<Id.Lit_Colon ':'>} ) ] redirects: [] ) terminator: <Id.Op_Semi _> ) (command.Simple blame_tok: <set> more_env: [] words: [{<set>} {<-->} {($ Id.VSub_DollarName a)}] redirects: [] do_fork: T ) (command.ShAssignment left: <Id.Lit_VarLike 'IFS='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'IFS='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'IFS='> name:IFS) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name oIFS))} ) ] redirects: [] ) (command.Sentence child: (command.ShAssignment left: <Id.Lit_VarLike 'init='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'init='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'init='> name:init) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number 1))} ) ] redirects: [] ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ShAssignment left: <Id.Lit_VarLike 'n='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'n='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'n='> name:n) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number 2))} ) ] redirects: [] ) terminator: <Id.Op_Semi _> ) (command.Sentence child: (command.ShAssignment left: <Id.Lit_VarLike 'res='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'res='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'res='> name:res) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_Number 3))} ) ] redirects: [] ) terminator: <Id.Op_Semi _> ) (command.Simple blame_tok: <shift> more_env: [] words: [{<shift>} {<3>}] redirects: [] do_fork: T ) (command.ShAssignment left: <Id.Lit_VarLike 'not='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'not='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'not='> name:not) op: assign_op.Equal rhs: (rhs_word__Empty) ) ] redirects: [] ) (command.ForEach keyword: <Id.KW_For for> iter_names: [b] iterable: (for_iter__Args) body: (command.DoGroup left: <Id.KW_Do do> children: [ (command.ShAssignment left: <Id.Lit_VarLike 'not='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'not='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'not='> name:not) op: assign_op.Equal rhs: { (DQ (${ Id.VSub_Name not) <' -o not-match:'> ($ Id.VSub_DollarName b) ) } ) ] redirects: [] ) ] right: <Id.KW_Done done> ) redirects: [] ) (command.Simple blame_tok: <atf_check> more_env: [] words: [ {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<-o>} {(DQ <'match:'> (${ Id.VSub_Name res))} {(${ Id.VSub_Name not)} {<-e>} {<empty>} {(${ Id.VSub_Name TEST_SH)} {<-c>} { (DQ <'set -- '> (${ Id.VSub_Name init) <'; shift '> ($ Id.VSub_DollarName n) <';'> ) (SQ <' echo "$# $*"'>) } ] redirects: [] do_fork: T ) ] right: <Id.KW_Done done> ) redirects: [] ) (command.Simple blame_tok: <atf_check> more_env: [] words: [ {<atf_check>} {<-s>} {<Id.ControlFlow_Exit exit> <Id.Lit_Colon ':'> <0>} {<-o>} {<match> <Id.Lit_Colon ':'> <complete>} {<-o>} {<not-match> <Id.Lit_Colon ':'> <ERR>} {<-e>} {<empty>} {(${ Id.VSub_Name TEST_SH)} {<-c>} {(SQ <'set -- a b c d e;while [ $# -gt 0 ];do shift||echo ERR;done;echo complete'>)} ] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.Simple blame_tok: <atf_test_case> more_env: [] words: [{<atf_test_case>} {<excessive_shift>}] redirects: [] do_fork: T ) (command.ShFunction name_tok: <excessive_shift_head> name: excessive_shift_head body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_set> more_env: [] words: [{<atf_set>} {(DQ <descr>)} {(DQ <'Test acceptable operation of shift too many'>)}] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <excessive_shift_body> name: excessive_shift_body body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ForEach keyword: <Id.KW_For for> iter_names: [a] iterable: (for_iter.Words words: [ {(DQ <'one-arg:2'>)} {(DQ <'one-arg:4'>)} {(DQ <'one-arg:13'>)} {(DQ <'one two:3'>)} {(DQ <'one two:7'>)} {(DQ <'one two three four five:6'>)} {(DQ <'I II III IV V VI VII VIII IX X XI XII XIII XIV XV:16'>)} {(DQ <'I II III IV V VI VII VIII IX X XI XII XIII XIV XV:17'>)} {(DQ <'I II III IV V VI VII VIII IX X XI XII XIII XIV XV:30'>)} {(DQ <'I II III IV V VI VII VIII IX X XI XII XIII XIV XV:9999'>)} ] ) body: (command.DoGroup left: <Id.KW_Do do> children: [ (command.ShAssignment left: <Id.Lit_VarLike 'oIFS='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'oIFS='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'oIFS='> name:oIFS) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name IFS))} ) ] redirects: [] ) (command.Sentence child: (command.ShAssignment left: <Id.Lit_VarLike 'IFS='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'IFS='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'IFS='> name:IFS) op: assign_op.Equal rhs: {<Id.Lit_Colon ':'>} ) ] redirects: [] ) terminator: <Id.Op_Semi _> ) (command.Simple blame_tok: <set> more_env: [] words: [{<set>} {<-->} {($ Id.VSub_DollarName a)}] redirects: [] do_fork: T ) (command.ShAssignment left: <Id.Lit_VarLike 'IFS='> pairs: [ (AssignPair left: <Id.Lit_VarLike 'IFS='> lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'IFS='> name:IFS) op: assign_op.Equal rhs: {(DQ (${ Id.VSub_Name oIFS))} ) ] redirects: [] ) (command.Simple blame_tok: <atf_check> more_env: [] words: [ {<atf_check>} {<-s>} {<not-exit> <Id.Lit_Colon ':'> <0>} {<-o>} {<match> <Id.Lit_Colon ':'> <OK>} {<-o>} {<not-match> <Id.Lit_Colon ':'> <ERR>} {<-e>} {<ignore>} {(${ Id.VSub_Name TEST_SH)} {<-c>} {(DQ <'set -- '> ($ Id.VSub_Number 1) <' ;'>) (SQ <'echo OK:$#-'>) (DQ ($ Id.VSub_Number 2) <';shift '> ($ Id.VSub_Number 2) <' && echo ERR'>) } ] redirects: [] do_fork: T ) ] right: <Id.KW_Done done> ) redirects: [] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.Simple blame_tok: <atf_test_case> more_env: [] words: [{<atf_test_case>} {<function_shift>}] redirects: [] do_fork: T ) (command.ShFunction name_tok: <function_shift_head> name: function_shift_head body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_set> more_env: [] words: [ {<atf_set>} {(DQ <descr>)} {(DQ <'Test that shift in a function does not affect outside'>)} ] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <function_shift_body> name: function_shift_body body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <Id.Lit_Colon ':'> more_env: [] words: [{<Id.Lit_Colon ':'>}] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.Simple blame_tok: <atf_test_case> more_env: [] words: [{<atf_test_case>} {<non_numeric_shift>}] redirects: [] do_fork: T ) (command.ShFunction name_tok: <non_numeric_shift_head> name: non_numeric_shift_head body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_set> more_env: [] words: [ {<atf_set>} {(DQ <descr>)} {(DQ <'Test that non-numeric args to shift are detected'>)} ] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <non_numeric_shift_body> name: non_numeric_shift_body body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ForEach keyword: <Id.KW_For for> iter_names: [a] iterable: (for_iter.Words words: [ {<a>} {<I>} {<0x12>} {<010>} {<5V>} {<-1>} {(SQ <' '>)} {(SQ )} {<Id.Lit_Other '+'> <1>} {(SQ <' 1'>)} ] ) body: (command.DoGroup left: <Id.KW_Do do> children: [ (command.Simple blame_tok: <atf_check> more_env: [] words: [ {<atf_check>} {<-s>} {<not-exit> <Id.Lit_Colon ':'> <0>} {<-o>} {<empty>} {<-e>} {<ignore>} {(${ Id.VSub_Name TEST_SH)} {<-c>} { (DQ <'set -- a b c d e f g h i; shift \''> ($ Id.VSub_DollarName a) <'\' && echo ERROR'> ) } ] redirects: [] do_fork: T ) ] right: <Id.KW_Done done> ) redirects: [] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.Simple blame_tok: <atf_test_case> more_env: [] words: [{<atf_test_case>} {<too_many_args>}] redirects: [] do_fork: T ) (command.ShFunction name_tok: <too_many_args_head> name: too_many_args_head body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_set> more_env: [] words: [ {<atf_set>} {(DQ <descr>)} {(DQ <'Test that sh detects invalid extraneous args to shift'>)} ] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <too_many_args_body> name: too_many_args_body body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ForEach keyword: <Id.KW_For for> iter_names: [a] iterable: (for_iter.Words words: [ {(DQ <'1 1'>)} {(DQ <'1 0'>)} {(DQ <'1 2 3'>)} {(DQ <'1 foo'>)} {(DQ <'1 --'>)} {(DQ <'-- 1'>)} ] ) body: (command.DoGroup left: <Id.KW_Do do> children: [ (command.Simple blame_tok: <atf_check> more_env: [] words: [ {<atf_check>} {<-s>} {<not-exit> <Id.Lit_Colon ':'> <0>} {<-o>} {<empty>} {<-e>} {<not-empty>} {(${ Id.VSub_Name TEST_SH)} {<-c>} {(DQ <' set -- a b c d; shift '> (${ Id.VSub_Name a) <' ; echo FAILED '>)} ] redirects: [] do_fork: T ) ] right: <Id.KW_Done done> ) redirects: [] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name_tok: <atf_init_test_cases> name: atf_init_test_cases body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple blame_tok: <atf_add_test_case> more_env: [] words: [{<atf_add_test_case>} {<basic_shift_test>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_add_test_case> more_env: [] words: [{<atf_add_test_case>} {<excessive_shift>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_add_test_case> more_env: [] words: [{<atf_add_test_case>} {<function_shift>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_add_test_case> more_env: [] words: [{<atf_add_test_case>} {<non_numeric_shift>}] redirects: [] do_fork: T ) (command.Simple blame_tok: <atf_add_test_case> more_env: [] words: [{<atf_add_test_case>} {<too_many_args>}] redirects: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) ] )