Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-09 Thread Stephen & Linda Smith
On Tuesday, January 8, 2019 11:58:29 PM MST Johannes Sixt wrote: > But notice that the value of $TODAY_REGEX contains blanks. > > In this line > > check_human_date "$(($(date +%s)-18000)) +0200" $TODAY_REGEX > > the value of $TODAY_REGEX is substituted and then the value is split > into fields a

Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-08 Thread Johannes Sixt
Am 09.01.19 um 01:44 schrieb Stephen P. Smith: On Tuesday, January 8, 2019 2:27:22 PM MST Johannes Sixt wrote: Am 31.12.18 um 01:31 schrieb Stephen P. Smith: + +TODAY_REGEX='[A-Z][a-z][a-z] [012][0-9]:[0-6][0-9] .0200' The $...REGEX expansions must be put in double-quotes to protect them fro

Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-08 Thread Stephen P. Smith
On Tuesday, January 8, 2019 2:27:22 PM MST Johannes Sixt wrote: > Am 31.12.18 um 01:31 schrieb Stephen P. Smith: > > + > > +TODAY_REGEX='[A-Z][a-z][a-z] [012][0-9]:[0-6][0-9] .0200' > The $...REGEX expansions must be put in double-quotes to protect them > from field splitting. But then the tests d

Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-08 Thread Johannes Sixt
Am 31.12.18 um 01:31 schrieb Stephen P. Smith: +check_human_date () { + time=$1 + expect=$2 + test_expect_success "check date ($format:$time)" ' + echo "$time -> $expect" >expect && + TZ=${zone:-$TZ} test-tool date show:"$format" "$time" >actual && +

Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-03 Thread Stephen P. Smith
On Thursday, January 3, 2019 2:45:39 PM MST Junio C Hamano wrote: > Philip Oakley writes: > >> > >>check_human_date 432000 "$THIS_YEAR_REGEX" # 5 days ago > > > > Just a quick bikeshed: if used, would this have a year end 5 day > > roll-over error potential, or will it always use the single

Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-03 Thread Junio C Hamano
Philip Oakley writes: > On 02/01/2019 18:15, Junio C Hamano wrote: >> We perhaps can use "test-tool date timestamp", like so >> >> check_human_date $(test-tool date timestamp "18000 seconds ago") ... >> >> or moving the part that munges 18000 into the above form inside >> check_human_date he

Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-03 Thread Philip Oakley
On 02/01/2019 18:15, Junio C Hamano wrote: We perhaps can use "test-tool date timestamp", like so check_human_date $(test-tool date timestamp "18000 seconds ago") ... or moving the part that munges 18000 into the above form inside check_human_date helper function, e.g. check_hu

Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-03 Thread Stephen P. Smith
On Wednesday, January 2, 2019 11:42:20 PM MST Junio C Hamano wrote: > > Are you suggesting that t4202-log.sh not be updated and that only and > > t7007- show.sh and t0006-date.sh updated? > > I am saying that using "log -1" and "show" in different tests _only_ > for the value of "Date:" field doe

Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-03 Thread Stephen & Linda Smith
On Thursday, January 3, 2019 12:44:22 AM MST Jeff King wrote: > We already have $TEST_DATE_NOW, which "test-tool date" will respect for > various commands to pretend that it's currently a particular time. I > think you'd need to add a sub-command similar to "relative" (which > directly calls show_d

Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-02 Thread Jeff King
On Sun, Dec 30, 2018 at 05:31:50PM -0700, Stephen P. Smith wrote: > The `human` date format varies based on two inputs: the date in the > reference time which is constant and the local computers date which > varies. Using hardcoded test expected output dates would require > holding the local mach

Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-02 Thread Junio C Hamano
Stephen & Linda Smith writes: > On Wednesday, January 2, 2019 11:15:02 AM MST Junio C Hamano wrote: >> 'date +%s' is used everywhere in this patch but has never been used >> in our test suite before. It is not portable. > So I don't make this mistake again, Is there a reference somewhere for tha

Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-02 Thread Stephen & Linda Smith
On Wednesday, January 2, 2019 11:15:02 AM MST Junio C Hamano wrote: > 'date +%s' is used everywhere in this patch but has never been used > in our test suite before. It is not portable. So I don't make this mistake again, Is there a reference somewhere for that is and is not portable? > > We pe

Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.

2019-01-02 Thread Junio C Hamano
"Stephen P. Smith" writes: > +# Subtract some known constant time and look for expected field format > +TODAY_REGEX='5 hours ago' > +THIS_YEAR_REGEX='[A-Z][a-z][a-z] [A-Z][a-z][a-z] [0-9]* > [012][0-9]:[0-6][0-9]' > +MORE_THAN_A_YEAR_REGEX='[A-Z][a-z][a-z] [A-Z][a-z][a-z] [0-9]* > [0-9][0-9][0-

[PATCH 3/3] t0006-date.sh: add `human` date format tests.

2018-12-30 Thread Stephen P. Smith
The `human` date format varies based on two inputs: the date in the reference time which is constant and the local computers date which varies. Using hardcoded test expected output dates would require holding the local machines date and time constant which is not desireable. Alternatively, lettin