fix(chaipa): Remove pretty print to avoid clang-tidy / added the options in echo

This commit is contained in:
Jean 2026-01-31 15:40:46 +01:00
parent 3cd231f031
commit 182e31b42e
7 changed files with 106 additions and 34 deletions

View file

@ -19,7 +19,7 @@ Test(utils_args, basic_command)
int r = args_handler(argc, input, &options, vars);
cr_expect(r == 0);
cr_expect(options.pretty_print == false);
// cr_expect(options.pretty_print == false);
cr_expect(options.verbose == false);
cr_expect(options.type == INPUT_CMD);
cr_expect(eq(options.input_source, "echo Hello, World!"));
@ -30,14 +30,16 @@ Test(utils_args, basic_command_with_flags)
{
int argc = 5;
struct args_options options;
char *input[] = { "program", "--pretty-print", "-c", "echo Hello, World!",
"--verbose" };
/* char *input[] = { "program", "--pretty-print", "-c", "echo Hello,
World!",
"--verbose" };*/
char *input[] = { "program", "-c", "echo Hello, World!", "--verbose" };
struct hash_map *vars = vars_init();
int r = args_handler(argc, input, &options, vars);
cr_expect(r == 0);
cr_expect(options.pretty_print == true);
// cr_expect(options.pretty_print == true);
cr_expect(options.verbose == true);
cr_expect(options.type == INPUT_CMD);
cr_expect(eq(options.input_source, "echo Hello, World!"));
@ -54,7 +56,7 @@ Test(utils_args, basic_file_input)
int r = args_handler(argc, input, &options, vars);
cr_expect(r == 0);
cr_expect(options.pretty_print == false);
// cr_expect(options.pretty_print == false);
cr_expect(options.verbose == false);
cr_expect(options.type == INPUT_FILE);
cr_expect(eq(options.input_source, "input.txt"));
@ -65,13 +67,15 @@ Test(utils_args, basic_file_input_with_flags)
{
int argc = 4;
struct args_options options;
char *input[] = { "program", "--verbose", "input.txt", "--pretty-print" };
// char *input[] = { "program", "--verbose", "input.txt", "--pretty-print"
// };
char *input[] = { "program", "--verbose", "input.txt" };
struct hash_map *vars = vars_init();
int r = args_handler(argc, input, &options, vars);
cr_expect(r == 0);
cr_expect(options.pretty_print == true);
// cr_expect(options.pretty_print == true);
cr_expect(options.verbose == true);
cr_expect(options.type == INPUT_FILE);
cr_expect(eq(options.input_source, "input.txt"));
@ -88,7 +92,7 @@ Test(utils_args, basic_stdin_input)
int r = args_handler(argc, input, &options, vars);
cr_expect(r == 0);
cr_expect(options.pretty_print == false);
// cr_expect(options.pretty_print == false);
cr_expect(options.verbose == false);
cr_expect(options.type == INPUT_STDIN);
cr_expect(options.input_source == NULL);
@ -99,13 +103,14 @@ Test(utils_args, pretty_print_and_verbose_flags)
{
int argc = 3;
struct args_options options;
char *input[] = { "program", "--pretty-print", "--verbose" };
// char *input[] = { "program", "--pretty-print", "--verbose" };
char *input[] = { "program", "--verbose" };
struct hash_map *vars = vars_init();
int r = args_handler(argc, input, &options, vars);
cr_expect(r == 0);
cr_expect(options.pretty_print == true);
// cr_expect(options.pretty_print == true);
cr_expect(options.verbose == true);
cr_expect(options.type == INPUT_STDIN);
cr_expect(options.input_source == NULL);