Skip to content

Commit

Permalink
libmbcommon: Use "using namespace testing" instead of testing::
Browse files Browse the repository at this point in the history
It's easier to read with heavy gmock usage.

Signed-off-by: Andrew Gunnerson <[email protected]>
  • Loading branch information
chenxiaolong committed Nov 25, 2018
1 parent 0f9f3be commit fa1bbfb
Show file tree
Hide file tree
Showing 5 changed files with 202 additions and 198 deletions.
21 changes: 11 additions & 10 deletions libmbcommon/tests/file/mock_test_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include "mbcommon/string.h"

using namespace mb;
using namespace testing;

TestFile::TestFile() : TestFile(nullptr)
{
Expand Down Expand Up @@ -179,17 +180,17 @@ MockTestFile::MockTestFile(TestFileCounters *counters) : TestFile(counters)
{
// Call original methods by default
ON_CALL(*this, on_open())
.WillByDefault(testing::Invoke(this, &MockTestFile::orig_on_open));
.WillByDefault(Invoke(this, &MockTestFile::orig_on_open));
ON_CALL(*this, on_close())
.WillByDefault(testing::Invoke(this, &MockTestFile::orig_on_close));
ON_CALL(*this, on_read(testing::_, testing::_))
.WillByDefault(testing::Invoke(this, &MockTestFile::orig_on_read));
ON_CALL(*this, on_write(testing::_, testing::_))
.WillByDefault(testing::Invoke(this, &MockTestFile::orig_on_write));
ON_CALL(*this, on_seek(testing::_, testing::_))
.WillByDefault(testing::Invoke(this, &MockTestFile::orig_on_seek));
ON_CALL(*this, on_truncate(testing::_))
.WillByDefault(testing::Invoke(this, &MockTestFile::orig_on_truncate));
.WillByDefault(Invoke(this, &MockTestFile::orig_on_close));
ON_CALL(*this, on_read(_, _))
.WillByDefault(Invoke(this, &MockTestFile::orig_on_read));
ON_CALL(*this, on_write(_, _))
.WillByDefault(Invoke(this, &MockTestFile::orig_on_write));
ON_CALL(*this, on_seek(_, _))
.WillByDefault(Invoke(this, &MockTestFile::orig_on_seek));
ON_CALL(*this, on_truncate(_))
.WillByDefault(Invoke(this, &MockTestFile::orig_on_truncate));
}

MockTestFile::~MockTestFile()
Expand Down
3 changes: 2 additions & 1 deletion libmbcommon/tests/file/test_callbacks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@
#include "mbcommon/file/callbacks.h"

using namespace mb;
using namespace testing;

struct FileCallbacksTest : testing::Test
struct FileCallbacksTest : Test
{
unsigned int _n_open_cb = 0;
unsigned int _n_close_cb = 0;
Expand Down
Loading

0 comments on commit fa1bbfb

Please sign in to comment.