66
77#include "funcs.c"
88
9- #define DEFAULT_FLAGS (TRIM_COMMAND_OUTPUT)
9+ #define DEFAULT_FLAGS (TRIM_COMMAND_OUTPUT | COMPARE_OUTPUTS )
1010
1111static uint32_t flags = DEFAULT_FLAGS ;
1212static const char * COMMENT_STR_LEFT = "[[!" ;
@@ -16,8 +16,8 @@ static const struct {
1616 Action act ;
1717 char * act_str ;
1818} act_map [] = {
19- { COMMAND , "command" }, { RETURNCODE , "returncode" }, { NAME , "name" },
20- { ACTION_SIZE , "action_size" }, { INVALID_ACTION , NULL }, { SINGLE_LINE_OUTPUT , NULL },
19+ { COMMAND , "command" }, { RETURNCODE , "returncode" }, { NAME , "name" },
20+ { ACTION_SIZE , NULL }, { INVALID_ACTION , NULL }, { SINGLE_LINE_OUTPUT , NULL },
2121 { MULTI_LINE_OUTPUT , NULL },
2222};
2323
@@ -35,6 +35,8 @@ static const struct {
3535 { APPEND_RELATIVE , "append_relative" },
3636 { ALWAYS_SHOW_OUTPUT , "always_show_output" },
3737 { SET_COMMENT_STRING , "set_comment_string" },
38+ { COMPARE_OUTPUTS , "compare_outputs" },
39+ { FLAG_SIZE , NULL },
3840 { INVALID_FLAG , NULL },
3941};
4042
@@ -193,11 +195,11 @@ int parse_flag(const char *unparsed_flag)
193195 char * value = copy_sub_str_offset (unparsed_flag , value_idx + 1 );
194196 int flag_on = flag_is_true (value , -1 );
195197 Flags e_flag = INVALID_FLAG ;
198+ debug_printf ("flag: %s, value: %s\n" , flag , value );
196199
197200 FOR_ALL_FLAGS (i ) {
198201 if (strcmp (flag , flag_map [i ].flag_str ) == 0 ) {
199202 e_flag = flag_map [i ].flag ;
200- debug_print_c (CYAN , "found flag '%s'\n" , flag_map [i ].flag_str );
201203 break ;
202204 }
203205 }
@@ -291,23 +293,14 @@ void add_line(Creal *creal, const char *line)
291293
292294void print_flags ()
293295{
294- verbose_printf ("active flags for runner:\n" );
295- if (flags & FAIL_UNEXPECTED_NEWLINES ) {
296- verbose_print_c (CYAN , "\tfail_unexpected_newlines\n" );
297- }
298- if (flags & STRICT ) {
299- verbose_print_c (CYAN , "\tstrict\n" );
300- }
301296 if (flags & VERBOSE ) {
302- verbose_print_c (CYAN , "\tverbose\n" );
303- }
304- if (flags & TRIM_COMMAND_OUTPUT ) {
305- verbose_print_c (CYAN , "\ttrim_command_output\n" );
306- }
307- if (flags & COLOR_OFF ) {
308- verbose_print_c (CYAN , "\tcolor_off\n" );
297+ FOR_ALL_FLAGS (i ) {
298+ if (flags & flag_map [i ].flag ) {
299+ print_c (CYAN , "\t%s\n" , flag_map [i ].flag_str );
300+ }
301+ }
302+ printf ("\n" );
309303 }
310- verbose_printf ("\n" );
311304}
312305
313306void print_diff (const Creal * expected , const Creal * actual , size_t start_of_diff )
@@ -360,7 +353,7 @@ int compare_creals(const Creal *expected, const Creal *actual)
360353 verbose_print_c (YELLOW , "testing runner '%s'\n" , expected -> name );
361354 print_flags ();
362355 size_t num_lines = expected -> lines ;
363- if (expected -> lines != 0 ) {
356+ if (flags & COMPARE_OUTPUTS ) {
364357 if (actual -> lines != expected -> lines ) {
365358 if (flags & STRICT ) {
366359 print_c (RED , "The output contains diffrent number of lines than "
0 commit comments