summaryrefslogtreecommitdiff
path: root/o3tl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-12-16 12:52:56 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-12-16 17:14:33 +0100
commit0d2ac93f4a3bec9d2fe2719b270333193d20596b (patch)
tree4c3e68d3c708c03b24f4e20181f2d6bd631399f4 /o3tl
parent9bc346dc55bd62f68b8d943d522810b28d84b0dc (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>
Diffstat (limited to 'o3tl')
-rw-r--r--o3tl/qa/test-string_view.cxx9
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);