Can use both main and nomain gtest in same project. Fixes #149.

pull/155/head
Jussi Pakkanen 10 years ago
parent 2c3986796e
commit 39c26d6fe0
  1. 2
      dependencies.py
  2. 4
      test cases/frameworks/2 gtest/meson.build
  3. 14
      test cases/frameworks/2 gtest/test_nomain.cc

@ -978,7 +978,7 @@ def get_dep_identifier(name, kwargs):
modlist = [modlist]
for module in modlist:
elements.append(module)
return '/'.join(elements)
return '/'.join(elements) + '/main' + str(kwargs.get('main', False))
def find_external_dependency(name, environment, kwargs):
required = kwargs.get('required', True)

@ -1,6 +1,10 @@
project('gtest', 'cpp')
gtest = dependency('gtest', main : true)
gtest_nomain = dependency('gtest', main : false)
e = executable('testprog', 'test.cc', dependencies : gtest)
test('gtest test', e)
e = executable('testprog_nomain', 'test_nomain.cc', dependencies : gtest_nomain)
test('gtest nomain test', e)

@ -0,0 +1,14 @@
#include<gtest/gtest.h>
TEST(basic_test, eq_works) {
ASSERT_EQ(0, 1-1) << "Equality is broken. Mass panic!";
}
TEST(basic_test, neq_works) {
ASSERT_NE(15, 106) << "Inequal is equal. The foundations of space and time are in jeopardy.";
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
Loading…
Cancel
Save