xref: /llvm-project/libcxx/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp (revision 57b08b0944046a6a57ee9b7b479181f548a5b9b4)
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 //===----------------------------------------------------------------------===//
8 
9 // <iomanip>
10 
11 // template<charT> T4 setfill(charT c);
12 
13 #include <iomanip>
14 #include <ostream>
15 #include <cassert>
16 
17 template <class CharT>
18 struct testbuf
19     : public std::basic_streambuf<CharT>
20 {
21     testbuf() {}
22 };
23 
24 int main()
25 {
26     {
27         testbuf<char> sb;
28         std::ostream os(&sb);
29         os << std::setfill('*');
30         assert(os.fill() == '*');
31     }
32     {
33         testbuf<wchar_t> sb;
34         std::wostream os(&sb);
35         os << std::setfill(L'*');
36         assert(os.fill() == L'*');
37     }
38 }
39