Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gtest already knows how to print std::string. #32198

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions searchcore/src/tests/proton/index/fusionrunner_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <vespa/vespalib/util/destructor_callbacks.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/stllike/string.h>
#include <filesystem>
#include <set>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <vespa/searchlib/parsequery/parse.h>
#include <vespa/searchcommon/attribute/config.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/util/compress.h>
#include <vespa/fastos/file.h>
#include <vespa/searchlib/attribute/enumstore.hpp>
Expand Down
1 change: 1 addition & 0 deletions searchlib/src/tests/searchcommon/schema/schema_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <vespa/searchcommon/common/schema.h>
#include <vespa/searchcommon/common/schemaconfigurer.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/testkit/test_path.h>
#include <fstream>
#include <string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <vespa/storage/frameworkimpl/component/storagecomponentregisterimpl.h>
#include <vespa/storageframework/defaultimplementation/clock/fakeclock.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/testkit/test_path.h>

#include <vespa/log/log.h>
Expand Down
1 change: 1 addition & 0 deletions vdslib/src/tests/state/clusterstatetest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <vespa/vdslib/state/random.h>
#include <vespa/vespalib/gtest/gtest.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/stllike/string.h>
#include <vespa/vespalib/util/exception.h>
#include <cmath>
#include <gmock/gmock.h>
Expand Down
11 changes: 1 addition & 10 deletions vespalib/src/vespa/vespalib/gtest/gtest.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@
#pragma once

#include <gtest/gtest.h>
#include <vespa/vespalib/stllike/string.h>
#include <iostream>

namespace vespalib {
// Tell google test how to print std::string values:
static inline void PrintTo(const std::string & value, std::ostream * os) {
*os << value;
}
}

/**
* Macro for creating a main function that runs all gtests.
Expand All @@ -29,7 +20,7 @@ main(int argc, char* argv[]) \
TRY_BLOCK; \
FAIL() << "exception '" << MESSAGE << "' not thrown at all!"; \
} catch(EXCEPTION_TYPE& e) { \
EXPECT_TRUE(contains(std::string_view(e.what()), std::string_view(MESSAGE))) << \
EXPECT_TRUE(std::string_view(e.what()).find(std::string_view(MESSAGE)) != std::string_view::npos) << \
baldersheim marked this conversation as resolved.
Show resolved Hide resolved
" e.what(): " << e.what() << "\n"; \
} catch(...) { \
FAIL() << "wrong exception type thrown"; \
Expand Down