[PowerPC][NFC] Cleanup PPCCTRLoopsVerify pass
[llvm-project.git] / libcxx / test / std / strings / string.view / string.view.io / stream_insert.pass.cpp
blob8ba444dc2cea5229e30e2f84b5d6e0f8eb57cd77
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: libcpp-has-no-localization
11 // <string>
13 // template<class charT, class traits, class Allocator>
14 // basic_ostream<charT, traits>&
15 // operator<<(basic_ostream<charT, traits>& os,
16 // const basic_string_view<charT,traits> str);
18 #include <string_view>
19 #include <sstream>
20 #include <cassert>
22 #include "test_macros.h"
24 using std::string_view;
25 using std::wstring_view;
27 int main(int, char**)
30 std::ostringstream out;
31 string_view sv("some text");
32 out << sv;
33 assert(out.good());
34 assert(sv == out.str());
37 std::ostringstream out;
38 std::string s("some text");
39 string_view sv(s);
40 out.width(12);
41 out << sv;
42 assert(out.good());
43 assert(" " + s == out.str());
46 std::wostringstream out;
47 wstring_view sv(L"some text");
48 out << sv;
49 assert(out.good());
50 assert(sv == out.str());
53 std::wostringstream out;
54 std::wstring s(L"some text");
55 wstring_view sv(s);
56 out.width(12);
57 out << sv;
58 assert(out.good());
59 assert(L" " + s == out.str());
62 return 0;