(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'test date parsing and printing'>)} spids: [4] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (command.CommandList children: [ (command.Sentence child: (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'TEST_DATE_NOW='> name:TEST_DATE_NOW) op: assign_op.Equal rhs: {<1251660000>} spids: [17] ) ] redirects: [] ) terminator: <Id.Op_Semi _> ) (C {<export>} {<TEST_DATE_NOW>}) ] ) (command.ShFunction name: check_relative body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 't='> name:t) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Minus left: {($ Id.VSub_DollarName TEST_DATE_NOW)} right: {($ Id.VSub_Number 1)} ) ) } spids: [33] ) ] redirects: [] ) (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_DollarName t) <' -> '> ($ Id.VSub_Number 2))}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})] more_env: [] do_fork: T ) (C {<test_expect_> (braced_var_sub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Number 3> var_name: 3 suffix_op: (suffix_op.Unary op:<Id.VTest_ColonHyphen _> arg_word:{<success>}) right: <Id.Right_DollarBrace '}'> ) } {(DQ <'relative date ('> ($ Id.VSub_Number 2) <')'>)} { (DQ <'\n'> <'\ttest-date relative '> ($ Id.VSub_DollarName t) <' >actual &&\n'> <'\ttest_i18ncmp expect actual\n'> <'\t'> ) } ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<check_relative>} {<5>} {(SQ <'5 seconds ago'>)}) (C {<check_relative>} {<300>} {(SQ <'5 minutes ago'>)}) (C {<check_relative>} {<18000>} {(SQ <'5 hours ago'>)}) (C {<check_relative>} {<432000>} {(SQ <'5 days ago'>)}) (C {<check_relative>} {<1728000>} {(SQ <'3 weeks ago'>)}) (C {<check_relative>} {<13000000>} {(SQ <'5 months ago'>)}) (C {<check_relative>} {<37500000>} {(SQ <'1 year, 2 months ago'>)}) (C {<check_relative>} {<55188000>} {(SQ <'1 year, 9 months ago'>)}) (C {<check_relative>} {<630000000>} {(SQ <'20 years ago'>)}) (C {<check_relative>} {<31449600>} {(SQ <'12 months ago'>)}) (C {<check_relative>} {<62985600>} {(SQ <'2 years ago'>)}) (command.ShFunction name: check_show body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'format='> name:format) op: assign_op.Equal rhs: {($ Id.VSub_Number 1)} spids: [178] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'time='> name:time) op: assign_op.Equal rhs: {($ Id.VSub_Number 2)} spids: [182] ) ] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'expect='> name:expect) op: assign_op.Equal rhs: {($ Id.VSub_Number 3)} spids: [186] ) ] redirects: [] ) (C {<test_expect_success>} {($ Id.VSub_Number 4)} { (DQ <'show date ('> ($ Id.VSub_DollarName format) <':'> ($ Id.VSub_DollarName time) <')'>) } { (SQ <'\n'> <'\t\techo "$time -> $expect" >expect &&\n'> <'\t\ttest-date show:$format "$time" >actual &&\n'> <'\t\ttest_cmp expect actual\n'> <'\t'> ) } ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'TIME='> name:TIME) op: assign_op.Equal rhs: {(SQ <'1466000000 +0200'>)} spids: [216] ) ] redirects: [] ) (C {<check_show>} {<iso8601>} {(DQ ($ Id.VSub_DollarName TIME))} {(SQ <'2016-06-15 16:13:20 +0200'>)}) (C {<check_show>} {<iso8601-strict>} {(DQ ($ Id.VSub_DollarName TIME))} {(SQ <'2016-06-15T16:13:20+02:00'>)} ) (C {<check_show>} {<rfc2822>} {(DQ ($ Id.VSub_DollarName TIME))} {(SQ <'Wed, 15 Jun 2016 16:13:20 +0200'>)} ) (C {<check_show>} {<short>} {(DQ ($ Id.VSub_DollarName TIME))} {(SQ <2016-06-15>)}) (C {<check_show>} {<default>} {(DQ ($ Id.VSub_DollarName TIME))} {(SQ <'Wed Jun 15 16:13:20 2016 +0200'>)} ) (C {<check_show>} {<raw>} {(DQ ($ Id.VSub_DollarName TIME))} {(SQ <'1466000000 +0200'>)}) (C {<check_show>} {<unix>} {(DQ ($ Id.VSub_DollarName TIME))} {(SQ <1466000000>)}) (C {<check_show>} {<iso-local>} {(DQ ($ Id.VSub_DollarName TIME))} {(SQ <'2016-06-15 14:13:20 +0000'>)} ) (C {<check_show>} {<raw-local>} {(DQ ($ Id.VSub_DollarName TIME))} {(SQ <'1466000000 +0000'>)}) (C {<check_show>} {<unix-local>} {(DQ ($ Id.VSub_DollarName TIME))} {(SQ <1466000000>)}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'FUTURE='> name:FUTURE) op: assign_op.Equal rhs: {(DQ <'5758122296 -0400'>)} spids: [345] ) ] redirects: [] ) (C {<check_show>} {<iso>} {(DQ ($ Id.VSub_DollarName FUTURE))} {(DQ <'2152-06-19 18:24:56 -0400'>)} {<LONG_IS_64BIT>} ) (C {<check_show>} {<iso-local>} {(DQ ($ Id.VSub_DollarName FUTURE))} {(DQ <'2152-06-19 22:24:56 +0000'>)} {<LONG_IS_64BIT>} ) (command.ShFunction name: check_parse body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_Number 1) <' -> '> ($ Id.VSub_Number 2))}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})] more_env: [] do_fork: T ) (C {<test_expect_> (braced_var_sub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Number 4> var_name: 4 suffix_op: (suffix_op.Unary op:<Id.VTest_ColonHyphen _> arg_word:{<success>}) right: <Id.Right_DollarBrace '}'> ) } { (DQ <'parse date ('> ($ Id.VSub_Number 1) (braced_var_sub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Number 3> var_name: 3 suffix_op: (suffix_op.Unary op: <Id.VTest_ColonPlus _> arg_word: {<' TZ='> ($ Id.VSub_Number 3)} ) right: <Id.Right_DollarBrace '}'> ) <')'> ) } { (DQ <'\n'> <'\tTZ='> (braced_var_sub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Number 3> var_name: 3 suffix_op: (suffix_op.Unary op: <Id.VTest_ColonHyphen _> arg_word: {($ Id.VSub_DollarName TZ)} ) right: <Id.Right_DollarBrace '}'> ) <' test-date parse \''> ($ Id.VSub_Number 1) <'\' >actual &&\n'> <'\ttest_cmp expect actual\n'> <'\t'> ) } ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<check_parse>} {<2008>} {<bad>}) (C {<check_parse>} {<2008-02>} {<bad>}) (C {<check_parse>} {<2008-02-14>} {<bad>}) (C {<check_parse>} {(SQ <'2008-02-14 20:30:45'>)} {(SQ <'2008-02-14 20:30:45 +0000'>)}) (C {<check_parse>} {(SQ <'2008-02-14 20:30:45 -0500'>)} {(SQ <'2008-02-14 20:30:45 -0500'>)}) (C {<check_parse>} {(SQ <'2008-02-14 20:30:45 -0015'>)} {(SQ <'2008-02-14 20:30:45 -0015'>)}) (C {<check_parse>} {(SQ <'2008-02-14 20:30:45 -5'>)} {(SQ <'2008-02-14 20:30:45 +0000'>)}) (C {<check_parse>} {(SQ <'2008-02-14 20:30:45 -5:'>)} {(SQ <'2008-02-14 20:30:45 +0000'>)}) (C {<check_parse>} {(SQ <'2008-02-14 20:30:45 -05'>)} {(SQ <'2008-02-14 20:30:45 -0500'>)}) (C {<check_parse>} {(SQ <'2008-02-14 20:30:45 -:30'>)} {(SQ <'2008-02-14 20:30:45 +0000'>)}) (C {<check_parse>} {(SQ <'2008-02-14 20:30:45 -05:00'>)} {(SQ <'2008-02-14 20:30:45 -0500'>)}) (C {<check_parse>} {(SQ <'2008-02-14 20:30:45'>)} {(SQ <'2008-02-14 20:30:45 -0500'>)} {<EST5>}) (command.ShFunction name: check_approxidate body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_Number 1) <' -> '> ($ Id.VSub_Number 2) <' +0000'>)}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expect>})] more_env: [] do_fork: T ) (C {<test_expect_> (braced_var_sub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Number 3> var_name: 3 suffix_op: (suffix_op.Unary op:<Id.VTest_ColonHyphen _> arg_word:{<success>}) right: <Id.Right_DollarBrace '}'> ) } {(DQ <'parse approxidate ('> ($ Id.VSub_Number 1) <')'>)} { (DQ <'\n'> <'\ttest-date approxidate \''> ($ Id.VSub_Number 1) <'\' >actual &&\n'> <'\ttest_cmp expect actual\n'> <'\t'> ) } ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<check_approxidate>} {<now>} {(SQ <'2009-08-30 19:20:00'>)}) (C {<check_approxidate>} {(SQ <'5 seconds ago'>)} {(SQ <'2009-08-30 19:19:55'>)}) (C {<check_approxidate>} {<5.seconds.ago>} {(SQ <'2009-08-30 19:19:55'>)}) (C {<check_approxidate>} {<10.minutes.ago>} {(SQ <'2009-08-30 19:10:00'>)}) (C {<check_approxidate>} {<yesterday>} {(SQ <'2009-08-29 19:20:00'>)}) (C {<check_approxidate>} {<3.days.ago>} {(SQ <'2009-08-27 19:20:00'>)}) (C {<check_approxidate>} {<3.weeks.ago>} {(SQ <'2009-08-09 19:20:00'>)}) (C {<check_approxidate>} {<3.months.ago>} {(SQ <'2009-05-30 19:20:00'>)}) (C {<check_approxidate>} {<2.years.3.months.ago>} {(SQ <'2007-05-30 19:20:00'>)}) (C {<check_approxidate>} {(SQ <'6am yesterday'>)} {(SQ <'2009-08-29 06:00:00'>)}) (C {<check_approxidate>} {(SQ <'6pm yesterday'>)} {(SQ <'2009-08-29 18:00:00'>)}) (C {<check_approxidate>} {(SQ <'3:00'>)} {(SQ <'2009-08-30 03:00:00'>)}) (C {<check_approxidate>} {(SQ <'15:00'>)} {(SQ <'2009-08-30 15:00:00'>)}) (C {<check_approxidate>} {(SQ <'noon today'>)} {(SQ <'2009-08-30 12:00:00'>)}) (C {<check_approxidate>} {(SQ <'noon yesterday'>)} {(SQ <'2009-08-29 12:00:00'>)}) (C {<check_approxidate>} {(SQ <'last tuesday'>)} {(SQ <'2009-08-25 19:20:00'>)}) (C {<check_approxidate>} {(SQ <'July 5th'>)} {(SQ <'2009-07-05 19:20:00'>)}) (C {<check_approxidate>} {(SQ <'06/05/2009'>)} {(SQ <'2009-06-05 19:20:00'>)}) (C {<check_approxidate>} {(SQ <06.05.2009>)} {(SQ <'2009-05-06 19:20:00'>)}) (C {<check_approxidate>} {(SQ <'Jun 6, 5AM'>)} {(SQ <'2009-06-06 05:00:00'>)}) (C {<check_approxidate>} {(SQ <'5AM Jun 6'>)} {(SQ <'2009-06-06 05:00:00'>)}) (C {<check_approxidate>} {(SQ <'6AM, June 7, 2009'>)} {(SQ <'2009-06-07 06:00:00'>)}) (C {<check_approxidate>} {(SQ <2008-12-01>)} {(SQ <'2008-12-01 19:20:00'>)}) (C {<check_approxidate>} {(SQ <2009-12-01>)} {(SQ <'2009-12-01 19:20:00'>)}) (C {<test_done>}) ] )