Re: [PATCH 3/3] t0006-date.sh: add `human` date format tests.
- From
Jeff King <peff@peff.net>
- Date
- Jan 3, 2019, 07:44 UTC
- Message-ID
- <20190103074421.GC24925@sigill.intra.peff.net>
- In-Reply-To
- <20181231003150.8031-4-ischis2@cox.net>
On Sun, Dec 30, 2018 at 05:31:50PM -0700, Stephen P. Smith wrote:
Show 9 quoted lines
> 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, letting the local date vary, which is the normal > situation, implies that the tests would be checking for formating > changes based on on a ref date relative to the local computers time.
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_date_relative()) which calls into the "human" code.
Note that there _isn't_ a way to have actual non-test git programs read the current time from an environment variable (as opposed to actually calling gettimeofday()).
-Peff