Skip to content

Commit d9cc2c8

Browse files
pcloudsgitster
authored andcommitted
t/helper: merge test-mktemp into test-tool
Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 34889d3 commit d9cc2c8

File tree

5 files changed

+7
-4
lines changed

5 files changed

+7
-4
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,13 +667,13 @@ TEST_BUILTINS_OBJS += test-index-version.o
667667
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
668668
TEST_BUILTINS_OBJS += test-match-trees.o
669669
TEST_BUILTINS_OBJS += test-mergesort.o
670+
TEST_BUILTINS_OBJS += test-mktemp.o
670671
TEST_BUILTINS_OBJS += test-sha1.o
671672

672673
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
673674
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
674675
TEST_PROGRAMS_NEED_X += test-fake-ssh
675676
TEST_PROGRAMS_NEED_X += test-line-buffer
676-
TEST_PROGRAMS_NEED_X += test-mktemp
677677
TEST_PROGRAMS_NEED_X += test-online-cpus
678678
TEST_PROGRAMS_NEED_X += test-parse-options
679679
TEST_PROGRAMS_NEED_X += test-path-utils

t/helper/test-mktemp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
/*
22
* test-mktemp.c: code to exercise the creation of temporary files
33
*/
4+
#include "test-tool.h"
45
#include "git-compat-util.h"
56

6-
int cmd_main(int argc, const char **argv)
7+
int cmd__mktemp(int argc, const char **argv)
78
{
89
if (argc != 2)
910
usage("Expected 1 parameter defining the temporary file template");

t/helper/test-tool.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ static struct test_cmd cmds[] = {
2222
{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
2323
{ "match-trees", cmd__match_trees },
2424
{ "mergesort", cmd__mergesort },
25+
{ "mktemp", cmd__mktemp },
2526
{ "sha1", cmd__sha1 },
2627
};
2728

t/helper/test-tool.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ int cmd__index_version(int argc, const char **argv);
1616
int cmd__lazy_init_name_hash(int argc, const char **argv);
1717
int cmd__match_trees(int argc, const char **argv);
1818
int cmd__mergesort(int argc, const char **argv);
19+
int cmd__mktemp(int argc, const char **argv);
1920
int cmd__sha1(int argc, const char **argv);
2021

2122
#endif

t/t0070-fundamental.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ test_expect_success 'character classes (isspace, isalpha etc.)' '
1313
'
1414

1515
test_expect_success 'mktemp to nonexistent directory prints filename' '
16-
test_must_fail test-mktemp doesnotexist/testXXXXXX 2>err &&
16+
test_must_fail test-tool mktemp doesnotexist/testXXXXXX 2>err &&
1717
grep "doesnotexist/test" err
1818
'
1919

2020
test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints filename' '
2121
mkdir cannotwrite &&
2222
chmod -w cannotwrite &&
2323
test_when_finished "chmod +w cannotwrite" &&
24-
test_must_fail test-mktemp cannotwrite/testXXXXXX 2>err &&
24+
test_must_fail test-tool mktemp cannotwrite/testXXXXXX 2>err &&
2525
grep "cannotwrite/test" err
2626
'
2727

0 commit comments

Comments
 (0)