diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-06-01 20:25:14 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-06-01 20:25:14 +0300 |
commit | 177e286b3c761f461ac55ede934b941384b4bb97 (patch) | |
tree | 367e49025a633bb7f5f212769ca3ee5c57cf4510 /test cases | |
parent | 0482635c1293ecc1148da8236f6b77cd4f21e130 (diff) | |
download | meson-177e286b3c761f461ac55ede934b941384b4bb97.zip meson-177e286b3c761f461ac55ede934b941384b4bb97.tar.gz meson-177e286b3c761f461ac55ede934b941384b4bb97.tar.bz2 |
Can generate config headers without an input file. Closes #549.
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/common/16 configure file/dumpprog.c | 33 | ||||
-rw-r--r-- | test cases/common/16 configure file/meson.build | 15 |
2 files changed, 48 insertions, 0 deletions
diff --git a/test cases/common/16 configure file/dumpprog.c b/test cases/common/16 configure file/dumpprog.c new file mode 100644 index 0000000..e0c9868 --- /dev/null +++ b/test cases/common/16 configure file/dumpprog.c @@ -0,0 +1,33 @@ +#define SHOULD_BE_UNDEFINED 1 + +#include"config3.h" +#include<string.h> +#include<stdio.h> + +#ifdef SHOULD_BE_UNDEFINED +#error Token did not get undefined. +#endif + +#ifndef SHOULD_BE_DEFINED +#error Token did not get defined +#endif + +int main(int argc, char **argv) { + if(strcmp(SHOULD_BE_STRING, "string") != 0) { + printf("String token defined wrong.\n"); + return 1; + } + if(SHOULD_BE_ONE != 1) { + printf("One defined incorrectly.\n"); + return 1; + } + if(SHOULD_BE_ZERO != 0) { + printf("Zero defined incorrectly.\n"); + return 1; + } + if(strcmp(SHOULD_BE_QUOTED_ONE, "1") != 0) { + printf("Quoted number defined incorrectly.\n"); + return 1; + } + SHOULD_BE_RETURN 0; +} diff --git a/test cases/common/16 configure file/meson.build b/test cases/common/16 configure file/meson.build index 8dec8fe..e1bdff3 100644 --- a/test cases/common/16 configure file/meson.build +++ b/test cases/common/16 configure file/meson.build @@ -30,3 +30,18 @@ command : [genprog, scriptfile, ifile, ofile], install_dir : 'share/appdir') test('inctest2', executable('prog2', 'prog2.c')) + +# Generate a conf file without an input file. + +dump = configuration_data() +dump.set('SHOULD_BE_STRING', '"string"') +dump.set('SHOULD_BE_RETURN', 'return') +dump.set('SHOULD_BE_DEFINED', true) +dump.set('SHOULD_BE_UNDEFINED', false) +dump.set('SHOULD_BE_ONE', 1) +dump.set('SHOULD_BE_ZERO', 0) +dump.set('SHOULD_BE_QUOTED_ONE', '"1"') +configure_file(output : 'config3.h', + configuration : dump) + +test('Configless.', executable('dumpprog', 'dumpprog.c')) |