meson.build 1.03 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
check = dependency('check', required: false)
if check.found()
  test_dependencies = [
    declare_dependency(link_with: girara),
    check
  ]

  include_directories += [ include_directories('../girara') ]

  test_sources = [
    'tests.c',
    'test_config.c',
    'test_datastructures.c',
    'test_session.c',
    'test_setting.c',
    'test_template.c',
    'test_utils.c'
  ]

  xdg_test_helper = executable('xdg_test_helper', 'xdg_test_helper.c',
    dependencies: [ glib, declare_dependency(link_with: girara) ],
Sebastian Ramacher's avatar
Sebastian Ramacher committed
22 23
    include_directories: include_directories,
    c_args: defines + flags
24 25 26 27 28
  )

  tests = executable('tests', test_sources,
    dependencies: build_dependencies + test_dependencies,
    include_directories: include_directories,
Sebastian Ramacher's avatar
Sebastian Ramacher committed
29
    c_args: defines + flags
30 31 32 33 34 35 36 37 38 39 40
  )

  env = environment()
  env.set('XDG_TEST_HELPER_PATH', meson.current_build_dir())
  env.set('HOME', '/home/test')
  test('tests-with-home', tests, env: env)

  # Cannot unset environment variables.
  # env.unset('HOME')
  # test('tests-without-home', tests, env: env)
endif