diff options
-rw-r--r-- | BUILD.gn | 2 | ||||
-rw-r--r-- | testing/fx_string_testhelpers.cpp | 18 | ||||
-rw-r--r-- | testing/fx_string_testhelpers.h | 15 | ||||
-rw-r--r-- | xfa/fgas/crt/cfgas_formatstring_unittest.cpp | 1 |
4 files changed, 36 insertions, 0 deletions
@@ -230,6 +230,8 @@ static_library("pdfium") { static_library("test_support") { testonly = true sources = [ + "testing/fx_string_testhelpers.cpp", + "testing/fx_string_testhelpers.h", "testing/test_support.cpp", "testing/test_support.h", "testing/utils/path_service.cpp", diff --git a/testing/fx_string_testhelpers.cpp b/testing/fx_string_testhelpers.cpp new file mode 100644 index 0000000000..443cc89ed1 --- /dev/null +++ b/testing/fx_string_testhelpers.cpp @@ -0,0 +1,18 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "testing/fx_string_testhelpers.h" + +#include <iomanip> +#include <ios> +#include <string> + +std::ostream& operator<<(std::ostream& os, const CFX_DateTime& dt) { + os << dt.GetYear() << "-" << std::to_string(dt.GetMonth()) << "-" + << std::to_string(dt.GetDay()) << " " << std::to_string(dt.GetHour()) + << ":" << std::to_string(dt.GetMinute()) << ":" + << std::to_string(dt.GetSecond()) << "." + << std::to_string(dt.GetMillisecond()); + return os; +} diff --git a/testing/fx_string_testhelpers.h b/testing/fx_string_testhelpers.h new file mode 100644 index 0000000000..34ac69dab4 --- /dev/null +++ b/testing/fx_string_testhelpers.h @@ -0,0 +1,15 @@ +// Copyright 2014 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef TESTING_FX_STRING_TESTHELPERS_H_ +#define TESTING_FX_STRING_TESTHELPERS_H_ + +#include <ostream> + +#include "core/fxcrt/cfx_datetime.h" + +// Output stream operator so GTEST macros work with CFX_DateTime objects. +std::ostream& operator<<(std::ostream& os, const CFX_DateTime& dt); + +#endif // TESTING_FX_STRING_TESTHELPERS_H_ diff --git a/xfa/fgas/crt/cfgas_formatstring_unittest.cpp b/xfa/fgas/crt/cfgas_formatstring_unittest.cpp index 2af1507635..3adcedf7b2 100644 --- a/xfa/fgas/crt/cfgas_formatstring_unittest.cpp +++ b/xfa/fgas/crt/cfgas_formatstring_unittest.cpp @@ -11,6 +11,7 @@ #include <memory> #include "core/fpdfapi/cpdf_modulemgr.h" +#include "testing/fx_string_testhelpers.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/test_support.h" #include "third_party/base/ptr_util.h" |