summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/headers/meson.build4
-rw-r--r--test/meson.build37
2 files changed, 24 insertions, 17 deletions
diff --git a/test/headers/meson.build b/test/headers/meson.build
index 3796d7f..2e18a44 100644
--- a/test/headers/meson.build
+++ b/test/headers/meson.build
@@ -37,11 +37,13 @@ endif
header_c_suppressions = cc.get_supported_arguments(header_c_suppressions)
+test_headers_source = files('test_headers.c')
+
test(
'headers',
executable(
'test_headers',
- files('test_headers.c'),
+ test_headers_source,
c_args: header_c_suppressions,
dependencies: [sratom_dep],
),
diff --git a/test/meson.build b/test/meson.build
index 75ccc6d..337f26d 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -11,29 +11,27 @@ subdir('headers')
# Unit Tests #
##############
-unit_tests = [
+test_sratom_source = files('test_sratom.c')
+
+test(
'sratom',
-]
-
-foreach unit : unit_tests
- test(
- unit,
- executable(
- 'test_@0@'.format(unit),
- files('test_@0@.c'.format(unit)),
- c_args: c_suppressions,
- dependencies: [sratom_dep, serd_dep, sord_dep],
- include_directories: include_directories('../src'),
- ),
- suite: 'unit',
- )
-endforeach
+ executable(
+ 'test_sratom',
+ test_sratom_source,
+ c_args: c_suppressions,
+ dependencies: [sratom_dep, serd_dep, sord_dep],
+ include_directories: include_directories('../src'),
+ ),
+ suite: 'unit',
+)
########
# Lint #
########
if get_option('lint')
+ all_sources = sources + test_sratom_source + test_headers_source
+
if not meson.is_subproject()
# Check release metadata
autoship = find_program('autoship', required: false)
@@ -48,4 +46,11 @@ if get_option('lint')
reuse_args = ['--root', sratom_src_root, 'lint']
test('REUSE', reuse, args: reuse_args, suite: 'data')
endif
+
+ # Check code formatting
+ clang_format = find_program('clang-format', required: false)
+ if clang_format.found()
+ clang_format_args = ['--Werror', '--dry-run'] + c_headers + all_sources
+ test('format', clang_format, args: clang_format_args, suite: 'code')
+ endif
endif