Browse Source

test: add build configs for catch2

pull/1243/head
Aleksei Bavshin 10 months ago
parent
commit
6eba62f060
No known key found for this signature in database
GPG Key ID: 4F071603387A382A
  1. 9
      meson.build
  2. 1
      meson_options.txt
  3. 12
      subprojects/catch2.wrap
  4. 4
      test/config.cpp
  5. 21
      test/meson.build

9
meson.build

@ -360,6 +360,15 @@ if scdoc.found()
endforeach
endif
catch2 = dependency(
'catch2',
fallback: ['catch2', 'catch2_dep'],
required: get_option('tests'),
)
if catch2.found()
subdir('test')
endif
clangtidy = find_program('clang-tidy', required: false)
if clangtidy.found()

1
meson_options.txt

@ -10,3 +10,4 @@ option('mpd', type: 'feature', value: 'auto', description: 'Enable support for t
option('gtk-layer-shell', type: 'feature', value: 'auto', description: 'Use gtk-layer-shell library for popups support')
option('rfkill', type: 'feature', value: 'auto', description: 'Enable support for RFKILL')
option('sndio', type: 'feature', value: 'auto', description: 'Enable support for sndio')
option('tests', type: 'feature', value: 'auto', description: 'Enable tests')

12
subprojects/catch2.wrap

@ -0,0 +1,12 @@
[wrap-file]
directory = Catch2-2.13.3
source_url = https://github.com/catchorg/Catch2/archive/v2.13.3.zip
source_filename = Catch2-2.13.3.zip
source_hash = 1804feb72bc15c0856b4a43aa586c661af9c3685a75973b6a8fc0b950c7cfd13
patch_url = https://github.com/mesonbuild/catch2/releases/download/2.13.3-2/catch2.zip
patch_filename = catch2-2.13.3-2-wrap.zip
patch_hash = 21b590ab8c65b593ad5ee8f8e5b822bf9877b2c2672f97fbb52459751053eadf
[provide]
catch2 = catch2_dep

4
test/config.cpp

@ -0,0 +1,4 @@
#define CATCH_CONFIG_MAIN
#include "config.hpp"
#include <catch2/catch.hpp>

21
test/meson.build

@ -0,0 +1,21 @@
test_inc = include_directories('../include')
test_dep = [
catch2,
fmt,
jsoncpp,
spdlog,
]
config_test = executable(
'config_test',
'config.cpp',
'../src/config.cpp',
dependencies: test_dep,
include_directories: test_inc,
)
test(
'Configuration test',
config_test,
workdir: meson.source_root(),
)
Loading…
Cancel
Save