From 97f5cff2a2ca37b207ea38c6fe984beb053536a9 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Wed, 26 Apr 2023 19:50:57 +0200 Subject: [PATCH] Add test cases with a question mark The test framework used to treat them specially (but no longer does). Add these test cases as non-regression for how the test framework allows "?" and especially "??" (which I think in the very distant path needed special handling because the test data was embedded in a .c file, and thus ?? could be interpreted as the prefix of a trigraph). Signed-off-by: Gilles Peskine --- tests/suites/test_suite_platform_printf.data | 12 ++++++++++++ tests/suites/test_suite_platform_printf.function | 1 + 2 files changed, 13 insertions(+) diff --git a/tests/suites/test_suite_platform_printf.data b/tests/suites/test_suite_platform_printf.data index 4be2f683a8..891771b919 100644 --- a/tests/suites/test_suite_platform_printf.data +++ b/tests/suites/test_suite_platform_printf.data @@ -74,6 +74,9 @@ printf_char2:"%c%c":DOUBLE_QUOTE_CHAR:SPACE_CHAR:"\" " printf "%c%c", COLON, SPACE printf_char2:"%c%c":COLON_CHAR:SPACE_CHAR:"\: " +printf "%c%c", QUESTION, SPACE +printf_char2:"%c%c":QUESTION_CHAR:SPACE_CHAR:"? " + printf "%c%c", BACKSLASH, SPACE printf_char2:"%c%c":BACKSLASH_CHAR:SPACE_CHAR:"\\ " @@ -86,6 +89,12 @@ printf_char2:"%c%c":COLON_CHAR:COLON_CHAR:"\:\:" printf "%c%c", COLON, NEWLINE printf_char2:"%c%c":COLON_CHAR:NEWLINE_CHAR:"\:\n" +printf "%c%c", QUESTION, QUESTION +printf_char2:"%c%c":QUESTION_CHAR:QUESTION_CHAR:"??" + +printf "%c%c", QUESTION, NEWLINE +printf_char2:"%c%c":QUESTION_CHAR:NEWLINE_CHAR:"?\n" + printf "%c%c", BACKSLASH, NEWLINE printf_char2:"%c%c":BACKSLASH_CHAR:NEWLINE_CHAR:"\\\n" @@ -95,6 +104,9 @@ printf_char2:"%c%c":BACKSLASH_CHAR:DOUBLE_QUOTE_CHAR:"\\\"" printf "%c%c", BACKSLASH, COLON printf_char2:"%c%c":BACKSLASH_CHAR:COLON_CHAR:"\\\:" +printf "%c%c", BACKSLASH, QUESTION +printf_char2:"%c%c":BACKSLASH_CHAR:QUESTION_CHAR:"\\?" + printf "%c%c", BACKSLASH, BACKSLASH printf_char2:"%c%c":BACKSLASH_CHAR:BACKSLASH_CHAR:"\\\\" diff --git a/tests/suites/test_suite_platform_printf.function b/tests/suites/test_suite_platform_printf.function index 1dd6ae5e11..3c816fe33b 100644 --- a/tests/suites/test_suite_platform_printf.function +++ b/tests/suites/test_suite_platform_printf.function @@ -19,6 +19,7 @@ #define SPACE_CHAR ' ' #define DOUBLE_QUOTE_CHAR '"' #define COLON_CHAR ':' +#define QUESTION_CHAR '?' #define BACKSLASH_CHAR '\\' #define LOWERCASE_N_CHAR 'n' /* END_HEADER */