t/helper: merge test-date into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nguyễn Thái Ngọc Duy committed
Mar 24, 2018 at 08:44 UTC
a801a7cfc7c009c11941d497e2d689164e4845f6
7 files changed
+19
-16
Makefile
+1
-1
@@ -655,10 +655,10 @@ PROGRAMS += $(patsubst %.o,git-%$X,$(PROGRAM_OBJS))
655
TEST_BUILTINS_OBJS += test-chmtime.o
656
TEST_BUILTINS_OBJS += test-config.o
657
TEST_BUILTINS_OBJS += test-ctype.o
658
+TEST_BUILTINS_OBJS += test-date.o
659
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
660
TEST_BUILTINS_OBJS += test-sha1.o
661
661
-TEST_PROGRAMS_NEED_X += test-date
662
TEST_PROGRAMS_NEED_X += test-delta
663
TEST_PROGRAMS_NEED_X += test-drop-caches
664
TEST_PROGRAMS_NEED_X += test-dump-cache-tree
t/helper/test-date.c
+9
-8
@@ -1,13 +1,14 @@
1
+#include "test-tool.h"
2
#include "cache.h"
3
4
static const char *usage_msg = "\n"
4
-" test-date relative [time_t]...\n"
5
-" test-date show:<format> [time_t]...\n"
6
-" test-date parse [date]...\n"
7
-" test-date approxidate [date]...\n"
8
-" test-date timestamp [date]...\n"
9
-" test-date is64bit\n"
10
-" test-date time_t-is64bit\n";
5
+" test-tool date relative [time_t]...\n"
6
+" test-tool date show:<format> [time_t]...\n"
7
+" test-tool date parse [date]...\n"
8
+" test-tool date approxidate [date]...\n"
9
+" test-tool date timestamp [date]...\n"
10
+" test-tool date is64bit\n"
11
+" test-tool date time_t-is64bit\n";
12
13
static void show_relative_dates(const char **argv, struct timeval *now)
14
{
@@ -81,7 +82,7 @@ static void parse_approx_timestamp(const char **argv, struct timeval *now)
82
}
83
}
84
84
-int cmd_main(int argc, const char **argv)
85
+int cmd__date(int argc, const char **argv)
86
{
87
struct timeval now;
88
const char *x;
t/helper/test-tool.c
+1
@@ -10,6 +10,7 @@ static struct test_cmd cmds[] = {
10
{ "chmtime", cmd__chmtime },
11
{ "config", cmd__config },
12
{ "ctype", cmd__ctype },
13
+ { "date", cmd__date },
14
{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
15
{ "sha1", cmd__sha1 },
16
};
t/helper/test-tool.h
+1
@@ -4,6 +4,7 @@
4
int cmd__chmtime(int argc, const char **argv);
5
int cmd__config(int argc, const char **argv);
6
int cmd__ctype(int argc, const char **argv);
7
+int cmd__date(int argc, const char **argv);
8
int cmd__lazy_init_name_hash(int argc, const char **argv);
9
int cmd__sha1(int argc, const char **argv);
10
t/t0006-date.sh
+4
-4
@@ -10,7 +10,7 @@ check_relative() {
10
t=$(($TEST_DATE_NOW - $1))
11
echo "$t -> $2" >expect
12
test_expect_${3:-success} "relative date ($2)" "
13
- test-date relative $t >actual &&
13
+ test-tool date relative $t >actual &&
14
test_i18ncmp expect actual
15
"
16
}
@@ -35,7 +35,7 @@ check_show () {
35
zone=$5
36
test_expect_success $prereqs "show date ($format:$time)" '
37
echo "$time -> $expect" >expect &&
38
- TZ=${zone:-$TZ} test-date show:"$format" "$time" >actual &&
38
+ TZ=${zone:-$TZ} test-tool date show:"$format" "$time" >actual &&
39
test_cmp expect actual
40
'
41
}
@@ -71,7 +71,7 @@ check_show iso-local "$FUTURE" "2152-06-19 22:24:56 +0000" TIME_IS_64BIT,TIME_T_
71
check_parse() {
72
echo "$1 -> $2" >expect
73
test_expect_${4:-success} "parse date ($1${3:+ TZ=$3})" "
74
- TZ=${3:-$TZ} test-date parse '$1' >actual &&
74
+ TZ=${3:-$TZ} test-tool date parse '$1' >actual &&
75
test_cmp expect actual
76
"
77
}
@@ -92,7 +92,7 @@ check_parse '2008-02-14 20:30:45' '2008-02-14 20:30:45 -0500' EST5
92
check_approxidate() {
93
echo "$1 -> $2 +0000" >expect
94
test_expect_${3:-success} "parse approxidate ($1)" "
95
- test-date approxidate '$1' >actual &&
95
+ test-tool date approxidate '$1' >actual &&
96
test_cmp expect actual
97
"
98
}
t/t1300-repo-config.sh
+1
-1
@@ -914,7 +914,7 @@ test_expect_success 'get --expiry-date' '
914
invalid1 = "abc"
915
EOF
916
cat >expect <<-EOF &&
917
- $(test-date timestamp $rel)
917
+ $(test-tool date timestamp $rel)
918
1275666415
919
1510441871
920
1510348087
t/test-lib.sh
+2
-2
@@ -1206,5 +1206,5 @@ test_lazy_prereq LONG_IS_64BIT '
1206
test 8 -le "$(build_option sizeof-long)"
1207
'
1208
1209
-test_lazy_prereq TIME_IS_64BIT 'test-date is64bit'
1210
-test_lazy_prereq TIME_T_IS_64BIT 'test-date time_t-is64bit'
1209
+test_lazy_prereq TIME_IS_64BIT 'test-tool date is64bit'
1210
+test_lazy_prereq TIME_T_IS_64BIT 'test-tool date time_t-is64bit'