mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
Build various unit-test main() programs in utils.
I found these while going through the code, and decided if we're going to have them then we should compile them. They didn't all compile first time, proving my point :-) I've enhanced the tree234 test so that it has a verbose option, which by default is off.
This commit is contained in:
@ -167,3 +167,8 @@ set_target_properties(puttygen PROPERTIES
|
||||
WIN32_EXECUTABLE ON
|
||||
LINK_FLAGS "${LFLAG_MANIFEST_NO}")
|
||||
installed_program(puttygen)
|
||||
|
||||
add_executable(test_split_into_argv
|
||||
utils/split_into_argv.c)
|
||||
target_compile_definitions(test_split_into_argv PRIVATE TEST)
|
||||
target_link_libraries(test_split_into_argv utils ${platform_libraries})
|
||||
|
@ -221,7 +221,7 @@ void split_into_argv(char *cmdline, int *argc, char ***argv,
|
||||
if (argstart) *argstart = outputargstart; else sfree(outputargstart);
|
||||
}
|
||||
|
||||
#ifdef TESTMODE
|
||||
#ifdef TEST
|
||||
|
||||
const struct argv_test {
|
||||
const char *cmdline;
|
||||
@ -323,6 +323,12 @@ const struct argv_test {
|
||||
{"\"a\\\\\\\\\"\"\"\"\"\"\"\"b c\" d", {"a\\\\\"\"\"b", "c d", NULL}},
|
||||
};
|
||||
|
||||
void out_of_memory(void)
|
||||
{
|
||||
fprintf(stderr, "out of memory!\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, j;
|
||||
@ -429,7 +435,7 @@ int main(int argc, char **argv)
|
||||
int ac;
|
||||
char **av;
|
||||
|
||||
split_into_argv(argv_tests[i].cmdline, &ac, &av);
|
||||
split_into_argv((char *)argv_tests[i].cmdline, &ac, &av, NULL);
|
||||
|
||||
for (j = 0; j < ac && argv_tests[i].argv[j]; j++) {
|
||||
if (strcmp(av[j], argv_tests[i].argv[j])) {
|
||||
@ -456,4 +462,4 @@ int main(int argc, char **argv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif /* TEST */
|
||||
|
Reference in New Issue
Block a user