From 6d2ba296a4ade3ad5852e22675857160174da7b0 Mon Sep 17 00:00:00 2001 From: Jules Laffitte Date: Tue, 10 Jan 2023 08:59:57 -0800 Subject: [PATCH] integrates `cwalktest` with meson build system * adds `ENABLE_TESTS` option to meson project * adds conditional compilation of `cwalktest` executable * registers `cwalktest` test with meson project --- meson.build | 4 ++++ meson_options.txt | 1 + test/meson.build | 23 +++++++++++++++++++++++ 3 files changed, 28 insertions(+) create mode 100644 meson_options.txt create mode 100644 test/meson.build diff --git a/meson.build b/meson.build index ae02230..0dd0e0c 100644 --- a/meson.build +++ b/meson.build @@ -14,3 +14,7 @@ cwalk = library('cwalk', 'src/cwalk.c', install_headers('include/cwalk.h') cwalk_dep = declare_dependency(include_directories: 'include', link_with: cwalk) + +if get_option('ENABLE_TESTS') + subdir('test') +endif diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 0000000..b8af6d0 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1 @@ +option('ENABLE_TESTS', type: 'boolean', value: false, description: 'Enables building test executables') diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 0000000..b62b2b9 --- /dev/null +++ b/test/meson.build @@ -0,0 +1,23 @@ +cwalktest_sources = files( + 'main.c', + 'absolute_test.c', + 'basename_test.c', + 'dirname_test.c', + 'extension_test.c', + 'guess_test.c', + 'intersection_test.c', + 'is_absolute_test.c', + 'is_relative_test.c', + 'join_test.c', + 'normalize_test.c', + 'relative_test.c', + 'root_test.c', + 'segment_test.c', + 'windows_test.c', +) + +cwalktest = executable('cwalktest', + sources: cwalktest_sources, + dependencies: cwalk_dep, +) +test('cwalktest', cwalktest)