xref: /llvm-project/libcxx/test/std/input.output/iostream.format/std.manip/setfill.pass.cpp (revision f4c1258d5633fcf06385ff3fd1f4bf57ab971964)
15a83710eSEric Fiselier //===----------------------------------------------------------------------===//
25a83710eSEric Fiselier //
357b08b09SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
457b08b09SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
557b08b09SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
65a83710eSEric Fiselier //
75a83710eSEric Fiselier //===----------------------------------------------------------------------===//
85a83710eSEric Fiselier 
95a83710eSEric Fiselier // <iomanip>
105a83710eSEric Fiselier 
115a83710eSEric Fiselier // template<charT> T4 setfill(charT c);
125a83710eSEric Fiselier 
135a83710eSEric Fiselier #include <iomanip>
145a127cdcSMarshall Clow #include <ostream>
155a83710eSEric Fiselier #include <cassert>
165a83710eSEric Fiselier 
177fc6a556SMarshall Clow #include "test_macros.h"
187fc6a556SMarshall Clow 
195a83710eSEric Fiselier template <class CharT>
205a83710eSEric Fiselier struct testbuf
215a83710eSEric Fiselier     : public std::basic_streambuf<CharT>
225a83710eSEric Fiselier {
testbuftestbuf235a83710eSEric Fiselier     testbuf() {}
245a83710eSEric Fiselier };
255a83710eSEric Fiselier 
main(int,char **)262df59c50SJF Bastien int main(int, char**)
275a83710eSEric Fiselier {
285a83710eSEric Fiselier     {
295a83710eSEric Fiselier         testbuf<char> sb;
305a83710eSEric Fiselier         std::ostream os(&sb);
315a83710eSEric Fiselier         os << std::setfill('*');
325a83710eSEric Fiselier         assert(os.fill() == '*');
335a83710eSEric Fiselier     }
34*f4c1258dSLouis Dionne #ifndef TEST_HAS_NO_WIDE_CHARACTERS
355a83710eSEric Fiselier     {
365a83710eSEric Fiselier         testbuf<wchar_t> sb;
375a83710eSEric Fiselier         std::wostream os(&sb);
385a83710eSEric Fiselier         os << std::setfill(L'*');
395a83710eSEric Fiselier         assert(os.fill() == L'*');
405a83710eSEric Fiselier     }
41*f4c1258dSLouis Dionne #endif
422df59c50SJF Bastien 
432df59c50SJF Bastien   return 0;
445a83710eSEric Fiselier }
45