xref: /llvm-project/libcxx/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp (revision f4c1258d5633fcf06385ff3fd1f4bf57ab971964)
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 #include "test_macros.h"
18 
19 template <class CharT>
20 struct testbuf
21     : public std::basic_streambuf<CharT>
22 {
testbuftestbuf23     testbuf() {}
24 };
25 
main(int,char **)26 int main(int, char**)
27 {
28     {
29         testbuf<char> sb;
30         std::ostream os(&sb);
31         os << std::setfill('*');
32         assert(os.fill() == '*');
33     }
34 #ifndef TEST_HAS_NO_WIDE_CHARACTERS
35     {
36         testbuf<wchar_t> sb;
37         std::wostream os(&sb);
38         os << std::setfill(L'*');
39         assert(os.fill() == L'*');
40     }
41 #endif
42 
43   return 0;
44 }
45