t/helper: merge test-submodule-config into test-tool
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Sat, 24 Mar 2018 07:45:01 +0000 (08:45 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 27 Mar 2018 15:45:47 +0000 (08:45 -0700)
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
t/helper/test-submodule-config.c
t/helper/test-tool.c
t/helper/test-tool.h
t/t7411-submodule-config.sh
index 6819792c2b9d43618f0b22b69662504550fed9c5..c1dc9ff8d65718893d5b7240023788c845fcbb4c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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-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
 
 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-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
 TEST_PROGRAMS_NEED_X += test-subprocess
 TEST_PROGRAMS_NEED_X += test-svn-fe
 TEST_PROGRAMS_NEED_X += test-tool
index f23db3b19a9911b554ca8eaf567cd0370d42af6e..5c6e4b010d61d2076f08e7077aa5ccbe6db665fc 100644 (file)
@@ -1,3 +1,4 @@
+#include "test-tool.h"
 #include "cache.h"
 #include "config.h"
 #include "submodule-config.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);
 }
 
        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;
 {
        const char **arg = argv;
        int my_argc = argc;
index c67307c28b8d92feb53d2fd82ae43928cdf0f55f..36b441a113d87878d91f00501c90cce74524f79f 100644 (file)
@@ -37,6 +37,7 @@ static struct test_cmd cmds[] = {
        { "sigchain", cmd__sigchain },
        { "strcmp-offset", cmd__strcmp_offset },
        { "string-list", cmd__string_list },
        { "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)
 };
 
 int cmd_main(int argc, const char **argv)
index 19ad2b0df89dd7669b04ee59abfcabf5d6042f5b..be7e79738f5caa334a9c5af3f37a5860b9cacda0 100644 (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__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
 
 #endif
index 46c09c77654597b2ee501271b4688cc6137df8f1..0bde5850ac547c90dadd9e21341ebad80a1471e6 100755 (executable)
@@ -41,7 +41,7 @@ test_expect_success 'configuration parsing with error' '
        EOF
        (
                cd repo &&
        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
        )
 '
                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_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 \
                        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_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 \
                        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" &&
                git add .gitmodules &&
                mv .gitmodules.bak .gitmodules &&
                git commit -m "add error" &&
-               test-submodule-config \
+               test-tool submodule-config \
                        HEAD b \
                        HEAD submodule \
                                >actual &&
                        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_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 &&
                        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}) &&
                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
        )
                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" &&
                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 &&
                        HEAD b \
                        HEAD submodule \
                                >actual &&