diff options
author | Daniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu> | 2010-05-24 09:36:33 -0700 |
---|---|---|
committer | Daniel Burrows <Daniel Burrows Daniel_Burrows@alumni.brown.edu> | 2010-05-24 09:36:33 -0700 |
commit | 8b81c0c1e773819f1d531b4d44388193bb93fd9e (patch) | |
tree | 605bc7357c5cbb7aa870ec47d8de1fcd359926f2 /site_scons | |
parent | 88e3dc1c2841098538d30c13fb2ce5d164ced183 (diff) | |
download | aptitude-8b81c0c1e773819f1d531b4d44388193bb93fd9e.tar.gz |
Start using google-mock to test the search input controller logic.
I use google-mock to create a mock implementation of the view, then
test that the logic interacts with it as expected. Right now, it
doesn't.
The ability to do this was part of why I wanted to separate the logic
from the view.
I haven't added google-mock to configure.ac yet; need to do that later.
Diffstat (limited to 'site_scons')
-rw-r--r-- | site_scons/aptitude_configure.py | 3 | ||||
-rw-r--r-- | site_scons/aptitude_configure_checks.py | 27 |
2 files changed, 30 insertions, 0 deletions
diff --git a/site_scons/aptitude_configure.py b/site_scons/aptitude_configure.py index f46a31b5..46b4c184 100644 --- a/site_scons/aptitude_configure.py +++ b/site_scons/aptitude_configure.py @@ -132,6 +132,9 @@ the Boost unit tests need.''' TryLibrary('boost_unit_test_framework') ]), "Can't find Boost.Test") + RequireCheck(conf.CheckForGoogleMock(), + "Can't find google-mock") + conf.Finish() def DoConfigureCppunitTests(env): diff --git a/site_scons/aptitude_configure_checks.py b/site_scons/aptitude_configure_checks.py index 75eee9cc..fd6006f9 100644 --- a/site_scons/aptitude_configure_checks.py +++ b/site_scons/aptitude_configure_checks.py @@ -236,6 +236,33 @@ int main(int argc, char **argv) boost::iostreams::filtering_ostream compressed_devnull(boost::iostreams::zlib_compressor(9) | devnull); }''', context.env['CXXFILESUFFIX']) +@ConfigureCheck("Checking for google-mock") +def CheckForGoogleMock(context): + """Look for gmock (headers and library). + +Brings gtest along for the ride, because otherwise gmock won't link.""" + + context.env.Append(LIBS = [ 'gmock', 'gtest' ]) + + return context.TryLink(''' +#include <gmock/gmock.h> + +class FooMock +{ +public: + MOCK_METHOD1(foo, void(int)); +}; + +int main(int argc, char **argv) +{ + ::testing::GTEST_FLAG(throw_on_failure) = true; + ::testing::InitGoogleMock(&argc, argv); + + FooMock mock; + mock.foo(4); +}''', context.env['CXXFILESUFFIX']) + + @ConfigureCheck("Checking for Boost.Test") def CheckForBoostTest(context): """Look for Boost.Test.""" |