diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2015-06-14 18:42:30 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2015-06-14 18:42:30 +0300 |
commit | 39c26d6fe007ae6012a3a4d41d8cadcafecc4048 (patch) | |
tree | 152afc5d7bd17eed55696c29467752891fa918e2 | |
parent | 2c3986796eaa9265deaae34ccb7b09bfb3b32df8 (diff) | |
download | meson-39c26d6fe007ae6012a3a4d41d8cadcafecc4048.zip meson-39c26d6fe007ae6012a3a4d41d8cadcafecc4048.tar.gz meson-39c26d6fe007ae6012a3a4d41d8cadcafecc4048.tar.bz2 |
Can use both main and nomain gtest in same project. Fixes #149.
-rw-r--r-- | dependencies.py | 2 | ||||
-rw-r--r-- | test cases/frameworks/2 gtest/meson.build | 4 | ||||
-rw-r--r-- | test cases/frameworks/2 gtest/test_nomain.cc | 14 |
3 files changed, 19 insertions, 1 deletions
diff --git a/dependencies.py b/dependencies.py index aa22533..ea914d9 100644 --- a/dependencies.py +++ b/dependencies.py @@ -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) diff --git a/test cases/frameworks/2 gtest/meson.build b/test cases/frameworks/2 gtest/meson.build index 50499a5..419f451 100644 --- a/test cases/frameworks/2 gtest/meson.build +++ b/test cases/frameworks/2 gtest/meson.build @@ -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) diff --git a/test cases/frameworks/2 gtest/test_nomain.cc b/test cases/frameworks/2 gtest/test_nomain.cc new file mode 100644 index 0000000..bd0bcfe --- /dev/null +++ b/test cases/frameworks/2 gtest/test_nomain.cc @@ -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(); +} |