Revert #456 because it causes issues for known types (#495) and is not C++98-compatible.
This commit is contained in:
Victor Zverovich
2017-05-06 08:36:54 -07:00
parent 79f11dbaa7
commit dcfd40a1b8
3 changed files with 0 additions and 84 deletions

View File

@@ -111,14 +111,6 @@ std::ostream &operator<<(std::ostream &os, EmptyTest) {
return os << "";
}
#if __cplusplus >= 201103L
struct UserDefinedTest { int i = 42; };
std::ostream &operator<<(std::ostream &os, const UserDefinedTest &u) {
return os << u.i;
}
#endif
TEST(OStreamTest, EmptyCustomOutput) {
EXPECT_EQ("", fmt::format("{}", EmptyTest()));
}
@@ -137,17 +129,6 @@ TEST(OStreamTest, WriteToOStream) {
EXPECT_EQ("foo", os.str());
}
#if __cplusplus >= 201103L
TEST(OStreamTest, WriteUserDefinedTypeToOStream) {
std::ostringstream os;
fmt::MemoryWriter w;
UserDefinedTest u;
w << "The answer is " << u;
fmt::internal::write(os, w);
EXPECT_EQ("The answer is 42", os.str());
}
#endif
TEST(OStreamTest, WriteToOStreamMaxSize) {
std::size_t max_size = std::numeric_limits<std::size_t>::max();
std::streamsize max_streamsize = std::numeric_limits<std::streamsize>::max();
@@ -191,26 +172,3 @@ TEST(OStreamTest, WriteToOStreamMaxSize) {
} while (size != 0);
fmt::internal::write(os, w);
}
#if __cplusplus >= 201103L
struct Xs {
const size_t size;
const std::string s;
Xs() : size(200), s(size, 'x') {}
};
inline std::ostream& operator<<(std::ostream& os, Xs const& xs) {
return os << xs.s;
}
TEST(OStreamTest, FormatBuf1) {
Xs xs;
fmt::MemoryWriter w;
int n = fmt::internal::INLINE_BUFFER_SIZE / xs.size + 1;
for (int i = 0; i < n; ++i)
w << xs;
EXPECT_EQ(w.size(), size_t(n * xs.size));
w << xs;
EXPECT_EQ(w.size(), size_t((n + 1) * xs.size));
}
#endif