diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-12-16 12:52:56 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-12-16 20:30:15 +0100 |
commit | fc0e731611ad7d485ebd46c600e796bbf1e75537 (patch) | |
tree | ca66a3b8c987c25e10a5e7c9f9083d81775e3e72 /o3tl | |
parent | 4f9e7da4ecbce74dc6ecc2b348160d80471ba29a (diff) |
Fix o3tl::string_view streaming operator <<
(The unnecessary os.setstate(std::ios_base::failbit) was due to a misreading of
C++17 [ostream.formatted.reqmts]/1.)
Change-Id: I7d8285230cb316c7af45c76029e9629517d05d56
Reviewed-on: https://gerrit.libreoffice.org/65217
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
(cherry picked from commit 0d2ac93f4a3bec9d2fe2719b270333193d20596b)
Reviewed-on: https://gerrit.libreoffice.org/65223
Diffstat (limited to 'o3tl')
-rw-r--r-- | o3tl/qa/test-string_view.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/o3tl/qa/test-string_view.cxx b/o3tl/qa/test-string_view.cxx index 977cfebc460a..fb6239fca379 100644 --- a/o3tl/qa/test-string_view.cxx +++ b/o3tl/qa/test-string_view.cxx @@ -9,7 +9,9 @@ #include <sal/config.h> +#include <sstream> #include <stdexcept> +#include <string> #include <cppunit/TestAssert.h> #include <cppunit/TestFixture.h> @@ -27,6 +29,7 @@ private: CPPUNIT_TEST(testChar32Literal); CPPUNIT_TEST(testWcharLiteral); CPPUNIT_TEST(testOperations); + CPPUNIT_TEST(testOutput); CPPUNIT_TEST_SUITE_END(); void testCharLiteral() { @@ -203,6 +206,12 @@ private: v.find_last_not_of("fxo", o3tl::string_view::npos, 2)); CPPUNIT_ASSERT_EQUAL(npos, v.find_last_not_of("fxo")); } + + void testOutput() { + std::ostringstream s; + s << o3tl::string_view("foo"); + CPPUNIT_ASSERT_EQUAL(std::string("foo"), s.str()); + } }; CPPUNIT_TEST_SUITE_REGISTRATION(Test); |