diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-19 16:20:42 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-07-20 20:51:08 +0000 |
commit | 189e40e11e51d0cba9232b960f495920985428b8 (patch) | |
tree | e0907ff5e2d5ac38684320b94b3ccf057df249ee /tests | |
parent | 0aea57dfc8e24262015ad1194b70302deb1afd21 (diff) |
Add QTextStream operators for QStringView
Change-Id: I72d597fa21521a04b7f7c0e41bd45ee9dabb6222
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp index df8746e518..edea4713a1 100644 --- a/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp +++ b/tests/auto/corelib/serialization/qtextstream/tst_qtextstream.cpp @@ -161,6 +161,7 @@ private slots: void string_write_operator_ToDevice(); void latin1String_write_operator_ToDevice(); void stringref_write_operator_ToDevice(); + void stringview_write_operator_ToDevice(); // other void skipWhiteSpace_data(); @@ -2573,6 +2574,17 @@ void tst_QTextStream::stringref_write_operator_ToDevice() QCOMPARE(buf.buffer().constData(), "No explicit lengthExplicit length"); } +void tst_QTextStream::stringview_write_operator_ToDevice() +{ + QBuffer buf; + buf.open(QBuffer::WriteOnly); + QTextStream stream(&buf); + const QStringView expected = QStringViewLiteral("expectedStringView"); + stream << expected; + stream.flush(); + QCOMPARE(buf.buffer().constData(), "expectedStringView"); +} + // ------------------------------------------------------------------------------ void tst_QTextStream::useCase1() { |