1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-08 00:26:33 +02:00

t/helper: merge test-submodule-config 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:
Nguyễn Thái Ngọc Duy 2018-03-24 08:45:01 +01:00 committed by Junio C Hamano
parent c932a5ff28
commit b618821306
5 changed files with 14 additions and 11 deletions

View File

@ -682,6 +682,7 @@ TEST_BUILTINS_OBJS += test-sha1.o
TEST_BUILTINS_OBJS += test-sigchain.o
TEST_BUILTINS_OBJS += test-strcmp-offset.o
TEST_BUILTINS_OBJS += test-string-list.o
TEST_BUILTINS_OBJS += test-submodule-config.o
TEST_PROGRAMS_NEED_X += test-dump-fsmonitor
TEST_PROGRAMS_NEED_X += test-dump-untracked-cache
@ -689,7 +690,6 @@ TEST_PROGRAMS_NEED_X += test-fake-ssh
TEST_PROGRAMS_NEED_X += test-line-buffer
TEST_PROGRAMS_NEED_X += test-parse-options
TEST_PROGRAMS_NEED_X += test-write-cache
TEST_PROGRAMS_NEED_X += test-submodule-config
TEST_PROGRAMS_NEED_X += test-subprocess
TEST_PROGRAMS_NEED_X += test-svn-fe
TEST_PROGRAMS_NEED_X += test-tool

View File

@ -1,3 +1,4 @@
#include "test-tool.h"
#include "cache.h"
#include "config.h"
#include "submodule-config.h"
@ -10,7 +11,7 @@ static void die_usage(int argc, const char **argv, const char *msg)
exit(1);
}
int cmd_main(int argc, const char **argv)
int cmd__submodule_config(int argc, const char **argv)
{
const char **arg = argv;
int my_argc = argc;

View File

@ -37,6 +37,7 @@ static struct test_cmd cmds[] = {
{ "sigchain", cmd__sigchain },
{ "strcmp-offset", cmd__strcmp_offset },
{ "string-list", cmd__string_list },
{ "submodule-config", cmd__submodule_config },
};
int cmd_main(int argc, const char **argv)

View File

@ -31,5 +31,6 @@ int cmd__sha1(int argc, const char **argv);
int cmd__sigchain(int argc, const char **argv);
int cmd__strcmp_offset(int argc, const char **argv);
int cmd__string_list(int argc, const char **argv);
int cmd__submodule_config(int argc, const char **argv);
#endif

View File

@ -41,7 +41,7 @@ test_expect_success 'configuration parsing with error' '
EOF
(
cd repo &&
test_must_fail test-submodule-config "" s 2>actual &&
test_must_fail test-tool submodule-config "" s 2>actual &&
test_i18ngrep "bad config" actual
)
'
@ -55,7 +55,7 @@ EOF
test_expect_success 'test parsing and lookup of submodule config by path' '
(cd super &&
test-submodule-config \
test-tool submodule-config \
HEAD^ a \
HEAD b \
HEAD^ submodule \
@ -67,7 +67,7 @@ test_expect_success 'test parsing and lookup of submodule config by path' '
test_expect_success 'test parsing and lookup of submodule config by name' '
(cd super &&
test-submodule-config --name \
test-tool submodule-config --name \
HEAD^ a \
HEAD a \
HEAD^ submodule \
@ -89,7 +89,7 @@ test_expect_success 'error in one submodule config lets continue' '
git add .gitmodules &&
mv .gitmodules.bak .gitmodules &&
git commit -m "add error" &&
test-submodule-config \
test-tool submodule-config \
HEAD b \
HEAD submodule \
>actual &&
@ -100,7 +100,7 @@ test_expect_success 'error in one submodule config lets continue' '
test_expect_success 'error message contains blob reference' '
(cd super &&
sha1=$(git rev-parse HEAD) &&
test-submodule-config \
test-tool submodule-config \
HEAD b \
HEAD submodule \
2>actual_err &&
@ -114,9 +114,9 @@ test_expect_success 'using different treeishs works' '
git tag new_tag &&
tree=$(git rev-parse HEAD^{tree}) &&
commit=$(git rev-parse HEAD^{commit}) &&
test-submodule-config $commit b >expect &&
test-submodule-config $tree b >actual.1 &&
test-submodule-config new_tag b >actual.2 &&
test-tool submodule-config $commit b >expect &&
test-tool submodule-config $tree b >actual.1 &&
test-tool submodule-config new_tag b >actual.2 &&
test_cmp expect actual.1 &&
test_cmp expect actual.2
)
@ -130,7 +130,7 @@ test_expect_success 'error in history in fetchrecursesubmodule lets continue' '
git config --unset -f .gitmodules \
submodule.submodule.fetchrecursesubmodules &&
git commit -m "add error in fetchrecursesubmodules" &&
test-submodule-config \
test-tool submodule-config \
HEAD b \
HEAD submodule \
>actual &&