]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/manipulators/standard/char/quoted.cc
1 // { dg-do run { target c++14 } }
3 // Copyright (C) 2013-2017 Free Software Foundation, Inc.
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 3, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING3. If not see
18 // <http://www.gnu.org/licenses/>.
20 // 27.7.6 - Quoted manipulators [quoted.manip]
25 #include <testsuite_hooks.h>
30 // Basic test from paper.
32 std::string original
= "foolish me";
33 std::string round_trip
;
34 ss
<< std::quoted(original
);
35 ss
>> std::quoted(round_trip
);
36 VERIFY( original
== round_trip
);
42 // Test skipws correctness.
44 ss
<< std::quoted("Hello Goodbye") << ' ' << 1 << ' ' << 2;
47 ss
>> std::quoted(song
) >> thing1
>> thing2
;
48 VERIFY( song
== "Hello Goodbye" );
49 VERIFY( thing1
== 1 );
50 VERIFY( thing2
== 2 );
56 // Test read of unquoted string.
60 ss
>> std::quoted(testit
);
61 VERIFY( testit
== "Alpha" );
65 test04(const std::string
& message
)
67 // Test 'const basic_string&'
69 ss
<< "** Error: " << std::quoted(message
) << " **";
79 auto ss
= test04("My biscuits are burnin'!");
80 VERIFY( ss
== "** Error: \"My biscuits are burnin'!\" **" );