2 // { dg-options "-std=gnu++1y" }
4 // Copyright (C) 2013 Free Software Foundation, Inc.
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 3, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING3. If not see
19 // <http://www.gnu.org/licenses/>.
21 // 27.7.6 - Quoted manipulators [quoted.manip]
26 #include <testsuite_hooks.h>
31 // Basic test from paper.
32 bool test
[[gnu::unused
]] = true;
33 std::wstringstream ss
;
34 std::wstring original
= L
"foolish me";
35 std::wstring round_trip
;
36 ss
<< std::quoted(original
);
37 ss
>> std::quoted(round_trip
);
38 VERIFY( original
== round_trip
);
44 // Test skipws correctness.
45 bool test
[[gnu::unused
]] = true;
46 std::wstringstream ss
;
47 ss
<< std::quoted(L
"Hello Goodbye") << L
' ' << 1 << L
' ' << 2;
50 ss
>> std::quoted(song
) >> thing1
>> thing2
;
51 VERIFY( song
== L
"Hello Goodbye" );
52 VERIFY( thing1
== 1 );
53 VERIFY( thing2
== 2 );
59 // Test read of unquoted string.
60 bool test
[[gnu::unused
]] = true;
61 std::wstringstream ss
;
64 ss
>> std::quoted(testit
);
65 VERIFY( testit
== L
"Alpha" );
69 test04(const std::wstring
& message
)
71 // Test 'const basic_string&'
72 bool test
[[gnu::unused
]] = true;
73 std::wstringstream ss
;
74 ss
<< L
"** Error: " << std::quoted(message
) << L
" **";
84 auto ss
= test04(L
"My biscuits are burnin'!");
85 VERIFY( ss
== L
"** Error: \"My biscuits are burnin'!\" **" );