Add test case for string literal concatenation.

This commit is contained in:
Christoph Behle 2018-06-10 17:43:19 +02:00 committed by Nirbheek Chauhan
parent ce27dd3aee
commit bbb893f39e
2 changed files with 16 additions and 0 deletions

View File

@ -0,0 +1,12 @@
#define __STRINGIFY(x) #x
#define TEST_STRINGIFY(x) __STRINGIFY(x)
#define TEST_VERSION_MAJOR 6
#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)
// TEST_VERSION_STR "6" "." "0" "." "0"

View File

@ -80,4 +80,8 @@ foreach lang : ['c', 'cpp']
have = cc.get_define('MESON_TEST_ISSUE_1665')
assert(have == '1', 'MESON_TEST_ISSUE_1665 value is "@0@" instead of "1"'.format(have))
endif
have = cc.get_define('TEST_VERSION_STR',
prefix : '#include <concat.h>', include_directories: include_directories('.'))
assert(have == '"6.0.0"', 'TEST_VERSION_STR value is "@0@" instead of ""6.0.0""'.format(have))
endforeach