Commit 0187f36aeb8a19a86a5c0f80ce180b0ce7ce83cb

Edward Thomson 2020-06-03T15:22:44

clar: parse arguments before printing the header We want to parse arguments before we start printing any output; the arguments themselves may impact the way we display that output.

diff --git a/tests/clar.c b/tests/clar.c
index ead13f4..73ac993 100644
--- a/tests/clar.c
+++ b/tests/clar.c
@@ -487,6 +487,9 @@ clar_parse_args(int argc, char **argv)
 void
 clar_test_init(int argc, char **argv)
 {
+	if (argc > 1)
+		clar_parse_args(argc, argv);
+
 	clar_print_init(
 		(int)_clar_callback_count,
 		(int)_clar_suite_count,
@@ -498,9 +501,6 @@ clar_test_init(int argc, char **argv)
 		_clar.summary_filename = strdup(_clar.summary_filename);
 	}
 
-	if (argc > 1)
-		clar_parse_args(argc, argv);
-
 	if (_clar.write_summary &&
 	    !(_clar.summary = clar_summary_init(_clar.summary_filename))) {
 		clar_print_onabort("Failed to open the summary file\n");