diff options
Diffstat (limited to '')
-rw-r--r-- | test cases/unit/90 devenv/main.c | 14 | ||||
-rw-r--r-- | test cases/unit/90 devenv/meson.build | 17 | ||||
-rw-r--r-- | test cases/unit/90 devenv/subprojects/sub/foo.c | 10 | ||||
-rw-r--r-- | test cases/unit/90 devenv/subprojects/sub/meson.build | 6 | ||||
-rwxr-xr-x | test cases/unit/90 devenv/test-devenv.py | 8 |
5 files changed, 55 insertions, 0 deletions
diff --git a/test cases/unit/90 devenv/main.c b/test cases/unit/90 devenv/main.c new file mode 100644 index 0000000..2710593 --- /dev/null +++ b/test cases/unit/90 devenv/main.c @@ -0,0 +1,14 @@ +#include <stdio.h> + +#ifdef _WIN32 + #define DO_IMPORT __declspec(dllimport) +#else + #define DO_IMPORT +#endif + +DO_IMPORT int foo(void); + +int main(void) { + printf("This is text.\n"); + return foo(); +} diff --git a/test cases/unit/90 devenv/meson.build b/test cases/unit/90 devenv/meson.build new file mode 100644 index 0000000..3b0bb6a --- /dev/null +++ b/test cases/unit/90 devenv/meson.build @@ -0,0 +1,17 @@ +project('devenv', 'c') + +meson.add_devenv('TEST_A=1') +foo_dep = dependency('foo', fallback: 'sub') + +env = environment() +env.append('TEST_B', ['2', '3'], separator: '+') +meson.add_devenv(env) + +meson.add_devenv({'TEST_B': '0'}, separator: '+', method: 'prepend') + +env = environment({'TEST_B': ['4']}, separator: '+', method: 'append') +meson.add_devenv(env) + +# This exe links on a library built in another directory. On Windows this means +# PATH must contain builddir/subprojects/sub to be able to run it. +executable('app', 'main.c', dependencies: foo_dep, install: true) diff --git a/test cases/unit/90 devenv/subprojects/sub/foo.c b/test cases/unit/90 devenv/subprojects/sub/foo.c new file mode 100644 index 0000000..46cb845 --- /dev/null +++ b/test cases/unit/90 devenv/subprojects/sub/foo.c @@ -0,0 +1,10 @@ +#ifdef _WIN32 + #define DO_EXPORT __declspec(dllexport) +#else + #define DO_EXPORT +#endif + +DO_EXPORT int foo(void) +{ + return 0; +} diff --git a/test cases/unit/90 devenv/subprojects/sub/meson.build b/test cases/unit/90 devenv/subprojects/sub/meson.build new file mode 100644 index 0000000..5cb1232 --- /dev/null +++ b/test cases/unit/90 devenv/subprojects/sub/meson.build @@ -0,0 +1,6 @@ +project('sub', 'c') + +meson.add_devenv({'TEST_B': '1'}) + +libfoo = shared_library('foo', 'foo.c') +meson.override_dependency('foo', declare_dependency(link_with: libfoo)) diff --git a/test cases/unit/90 devenv/test-devenv.py b/test cases/unit/90 devenv/test-devenv.py new file mode 100755 index 0000000..75497ff --- /dev/null +++ b/test cases/unit/90 devenv/test-devenv.py @@ -0,0 +1,8 @@ +#! /usr/bin/python + +import os + +assert os.environ['MESON_DEVENV'] == '1' +assert os.environ['MESON_PROJECT_NAME'] == 'devenv' +assert os.environ['TEST_A'] == '1' +assert os.environ['TEST_B'] == '0+1+2+3+4' |