t0006: rename test-date's "show" to "relative"

The "show" tests are really only checking relative formats; we should make that more clear. This also frees up the "show" name to later check other formats. We could later fold "relative" into a more generic "show" command, but it's not worth it. Relative times are a special case already because we have to munge the concept of "now" in our tests. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Jun 20, 2016 at 17:10 UTC fdba2cdec47b1760422107c671feef1d2a57b8af
2 files changed +17 -17
t/t0006-date.sh
+13 -13
@@ -6,26 +6,26 @@ test_description='test date parsing and printing'
6 # arbitrary reference time: 2009-08-30 19:20:00
7 TEST_DATE_NOW=1251660000; export TEST_DATE_NOW
8
9 -check_show() {
9 +check_relative() {
10 t=$(($TEST_DATE_NOW - $1))
11 echo "$t -> $2" >expect
12 test_expect_${3:-success} "relative date ($2)" "
13 - test-date show $t >actual &&
13 + test-date relative $t >actual &&
14 test_i18ncmp expect actual
15 "
16 }
17
18 -check_show 5 '5 seconds ago'
19 -check_show 300 '5 minutes ago'
20 -check_show 18000 '5 hours ago'
21 -check_show 432000 '5 days ago'
22 -check_show 1728000 '3 weeks ago'
23 -check_show 13000000 '5 months ago'
24 -check_show 37500000 '1 year, 2 months ago'
25 -check_show 55188000 '1 year, 9 months ago'
26 -check_show 630000000 '20 years ago'
27 -check_show 31449600 '12 months ago'
28 -check_show 62985600 '2 years ago'
18 +check_relative 5 '5 seconds ago'
19 +check_relative 300 '5 minutes ago'
20 +check_relative 18000 '5 hours ago'
21 +check_relative 432000 '5 days ago'
22 +check_relative 1728000 '3 weeks ago'
23 +check_relative 13000000 '5 months ago'
24 +check_relative 37500000 '1 year, 2 months ago'
25 +check_relative 55188000 '1 year, 9 months ago'
26 +check_relative 630000000 '20 years ago'
27 +check_relative 31449600 '12 months ago'
28 +check_relative 62985600 '2 years ago'
29
30 check_parse() {
31 echo "$1 -> $2" >expect
test-date.c
+4 -4
@@ -1,11 +1,11 @@
1 #include "cache.h"
2
3 static const char *usage_msg = "\n"
4 -" test-date show [time_t]...\n"
4 +" test-date relative [time_t]...\n"
5 " test-date parse [date]...\n"
6 " test-date approxidate [date]...\n";
7
8 -static void show_dates(char **argv, struct timeval *now)
8 +static void show_relative_dates(char **argv, struct timeval *now)
9 {
10 struct strbuf buf = STRBUF_INIT;
11
@@ -61,8 +61,8 @@ int main(int argc, char **argv)
61 argv++;
62 if (!*argv)
63 usage(usage_msg);
64 - if (!strcmp(*argv, "show"))
65 - show_dates(argv+1, &now);
64 + if (!strcmp(*argv, "relative"))
65 + show_relative_dates(argv+1, &now);
66 else if (!strcmp(*argv, "parse"))
67 parse_dates(argv+1, &now);
68 else if (!strcmp(*argv, "approxidate"))