summaryrefslogtreecommitdiffstats
path: root/libcxx/test
diff options
context:
space:
mode:
authorMarshall Clow <mclow.lists@gmail.com>2014-03-07 21:45:32 +0000
committerMarshall Clow <mclow.lists@gmail.com>2014-03-07 21:45:32 +0000
commitb162b17f05375d91fc121df2182207bfefd4d7d1 (patch)
treefb695ef85cf695a493c35ccd3e8ec49dd59d4148 /libcxx/test
parent15ae783e1487666b5c84f2defdf566cb0435ad95 (diff)
downloadbcm5719-llvm-b162b17f05375d91fc121df2182207bfefd4d7d1.tar.gz
bcm5719-llvm-b162b17f05375d91fc121df2182207bfefd4d7d1.zip
Implement LWG #2344: quoted()'s interaction with padding is unclear. I think that anyone using quoted with padding is really confused, but it should work the way the rest of iostreams works.
llvm-svn: 203290
Diffstat (limited to 'libcxx/test')
-rw-r--r--libcxx/test/input.output/iostream.format/quoted.manip/quoted.pass.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/libcxx/test/input.output/iostream.format/quoted.manip/quoted.pass.cpp b/libcxx/test/input.output/iostream.format/quoted.manip/quoted.pass.cpp
index 1f6b1267484..d09b3cae4f6 100644
--- a/libcxx/test/input.output/iostream.format/quoted.manip/quoted.pass.cpp
+++ b/libcxx/test/input.output/iostream.format/quoted.manip/quoted.pass.cpp
@@ -28,13 +28,13 @@ bool is_skipws ( const std::wistream *is ) {
}
void both_ways ( const char *p ) {
- std::string str(p);
- auto q = std::quoted(str);
+ std::string str(p);
+ auto q = std::quoted(str);
std::stringstream ss;
bool skippingws = is_skipws ( &ss );
- ss << q;
- ss >> q;
+ ss << q;
+ ss >> q;
}
void round_trip ( const char *p ) {
@@ -92,6 +92,20 @@ std::string unquote ( const char *p, char delim='"', char escape='\\' ) {
return s;
}
+void test_padding () {
+ {
+ std::stringstream ss;
+ ss << std::left << std::setw(10) << std::setfill('!') << std::quoted("abc", '`');
+ assert ( ss.str() == "`abc`!!!!!" );
+ }
+
+ {
+ std::stringstream ss;
+ ss << std::right << std::setw(10) << std::setfill('!') << std::quoted("abc", '`');
+ assert ( ss.str() == "!!!!!`abc`" );
+ }
+}
+
void round_trip ( const wchar_t *p ) {
std::wstringstream ss;
@@ -197,6 +211,7 @@ int main()
assert ( unquote ( "" ) == "" ); // nothing there
assert ( unquote ( L"" ) == L"" ); // nothing there
+ test_padding ();
}
#else
OpenPOWER on IntegriCloud