diff --git a/test cases/common/140 get define/concat.h b/test cases/common/140 get define/concat.h index 711e5b17b..b32a4f3da 100644 --- a/test cases/common/140 get define/concat.h +++ b/test cases/common/140 get define/concat.h @@ -5,8 +5,19 @@ #define TEST_VERSION_MINOR 0 #define TEST_VERSION_BUGFIX 0 -#define TEST_VERSION_STR \ - TEST_STRINGIFY(TEST_VERSION_MAJOR) \ - "." TEST_STRINGIFY(TEST_VERSION_MINOR) "." TEST_STRINGIFY(TEST_VERSION_BUGFIX) +#define TEST_VERSION_STR \ + TEST_STRINGIFY(TEST_VERSION_MAJOR) \ + "." TEST_STRINGIFY(TEST_VERSION_MINOR) "." TEST_STRINGIFY( \ + TEST_VERSION_BUGFIX) -// TEST_VERSION_STR "6" "." "0" "." "0" +#define TEST_CONCAT_1 \ + "ab" \ + "cd" \ + "ef" +#define TEST_CONCAT_2 1 +#define TEST_CONCAT_3 1 2 3 +#define TEST_CONCAT_4 "ab" 1 "cd" +#define TEST_CONCAT_5 \ + "ab\"" \ + "cd" +#define TEST_CONCAT_6 "ab\" \"cd" diff --git a/test cases/common/140 get define/meson.build b/test cases/common/140 get define/meson.build index 5d7f858f2..6d7cbfa4b 100644 --- a/test cases/common/140 get define/meson.build +++ b/test cases/common/140 get define/meson.build @@ -84,4 +84,18 @@ foreach lang : ['c', 'cpp'] have = cc.get_define('TEST_VERSION_STR', prefix : '#include ', include_directories: include_directories('.'), concatenate_string_literals: true) assert(have == '"6.0.0"', 'TEST_VERSION_STR value is "@0@" instead of ""6.0.0""'.format(have)) + + concat_examples = { + 'TEST_CONCAT_1': '"abcdef"', + 'TEST_CONCAT_2': '1', + 'TEST_CONCAT_3': '1 2 3', + 'TEST_CONCAT_4': '"ab" 1 "cd"', + 'TEST_CONCAT_5': '"ab\"cd"', + 'TEST_CONCAT_6': '"ab\" \"cd"', + } + foreach def,expected : concat_examples + have = cc.get_define(def, + prefix : '#include ', include_directories: include_directories('.'), concatenate_string_literals: true) + assert(have == expected, '@0@ value is "@1@" instead of "@2@"'.format(def, have, expected)) + endforeach endforeach