t/helper: merge test-mktemp 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>
This commit is contained in:
parent
34889d3cd7
commit
d9cc2c8780
2
Makefile
2
Makefile
@ -667,13 +667,13 @@ TEST_BUILTINS_OBJS += test-index-version.o
|
||||
TEST_BUILTINS_OBJS += test-lazy-init-name-hash.o
|
||||
TEST_BUILTINS_OBJS += test-match-trees.o
|
||||
TEST_BUILTINS_OBJS += test-mergesort.o
|
||||
TEST_BUILTINS_OBJS += test-mktemp.o
|
||||
TEST_BUILTINS_OBJS += test-sha1.o
|
||||
|
||||
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
|
||||
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
|
||||
TEST_PROGRAMS_NEED_X += test-fake-ssh
|
||||
TEST_PROGRAMS_NEED_X += test-line-buffer
|
||||
TEST_PROGRAMS_NEED_X += test-mktemp
|
||||
TEST_PROGRAMS_NEED_X += test-online-cpus
|
||||
TEST_PROGRAMS_NEED_X += test-parse-options
|
||||
TEST_PROGRAMS_NEED_X += test-path-utils
|
||||
|
@ -1,9 +1,10 @@
|
||||
/*
|
||||
* test-mktemp.c: code to exercise the creation of temporary files
|
||||
*/
|
||||
#include "test-tool.h"
|
||||
#include "git-compat-util.h"
|
||||
|
||||
int cmd_main(int argc, const char **argv)
|
||||
int cmd__mktemp(int argc, const char **argv)
|
||||
{
|
||||
if (argc != 2)
|
||||
usage("Expected 1 parameter defining the temporary file template");
|
||||
|
@ -22,6 +22,7 @@ static struct test_cmd cmds[] = {
|
||||
{ "lazy-init-name-hash", cmd__lazy_init_name_hash },
|
||||
{ "match-trees", cmd__match_trees },
|
||||
{ "mergesort", cmd__mergesort },
|
||||
{ "mktemp", cmd__mktemp },
|
||||
{ "sha1", cmd__sha1 },
|
||||
};
|
||||
|
||||
|
@ -16,6 +16,7 @@ int cmd__index_version(int argc, const char **argv);
|
||||
int cmd__lazy_init_name_hash(int argc, const char **argv);
|
||||
int cmd__match_trees(int argc, const char **argv);
|
||||
int cmd__mergesort(int argc, const char **argv);
|
||||
int cmd__mktemp(int argc, const char **argv);
|
||||
int cmd__sha1(int argc, const char **argv);
|
||||
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@ test_expect_success 'character classes (isspace, isalpha etc.)' '
|
||||
'
|
||||
|
||||
test_expect_success 'mktemp to nonexistent directory prints filename' '
|
||||
test_must_fail test-mktemp doesnotexist/testXXXXXX 2>err &&
|
||||
test_must_fail test-tool mktemp doesnotexist/testXXXXXX 2>err &&
|
||||
grep "doesnotexist/test" err
|
||||
'
|
||||
|
||||
@ -21,7 +21,7 @@ test_expect_success POSIXPERM,SANITY 'mktemp to unwritable directory prints file
|
||||
mkdir cannotwrite &&
|
||||
chmod -w cannotwrite &&
|
||||
test_when_finished "chmod +w cannotwrite" &&
|
||||
test_must_fail test-mktemp cannotwrite/testXXXXXX 2>err &&
|
||||
test_must_fail test-tool mktemp cannotwrite/testXXXXXX 2>err &&
|
||||
grep "cannotwrite/test" err
|
||||
'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user